{"id":650,"date":"2017-02-06T13:52:52","date_gmt":"2017-02-06T21:52:52","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=650"},"modified":"2017-02-06T13:53:44","modified_gmt":"2017-02-06T21:53:44","slug":"linked-list-vs-array","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=650","title":{"rendered":"Linked List vs Array"},"content":{"rendered":"<p>Advantages of Linked List :<br \/>\n&#8211; Can be expanded in constant time.  Dynamic allocation of storage. To create array we must allocate memory for certain number of elements. To add more elements we must create a new array and copy the old array into nw.<br \/>\nInsertion at beginning of linked list is O(1)<\/p>\n<p>Disadvantages of Linked List:<br \/>\n&#8211; Access time to individual elements  O(n).  Array takes O(1)<br \/>\n&#8211; Arrays have &#8220;Locality in memory&#8221;. Arrays are contiguous blocks of memory. Any array element will be physically near its neighbors. This benefits from modern CPU caching mechanisms. Linked List elements can be scattered.<br \/>\n&#8211; Linked List are harder to manipulate. You need to change pointers if deleting from middle or end, etc.<br \/>\n&#8211; Wasted memory in terms of extra reference points<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Advantages of Linked List : &#8211; Can be expanded in constant time. Dynamic allocation of storage. To create array we must allocate memory for certain number of elements. To add more elements we must create a new array and copy the old array into nw. Insertion at beginning of linked list is O(1) Disadvantages of &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=650\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Linked List vs Array<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-650","post","type-post","status-publish","format-standard","hentry","category-data-structures"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/650","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=650"}],"version-history":[{"count":2,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/650\/revisions"}],"predecessor-version":[{"id":652,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/650\/revisions\/652"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=650"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=650"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=650"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}