1 1 vote Which of the following data structures will be the most efficient for inserting a number into a sorted list of numbers? Queue Stack Linked list Array Programming in C data-structures + – Sourabh Kumar 1.7k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes queue & stack are of no use in sorted list as they have only one policy fifo and lifo. linked list will take more time than array in inserting(as in sorted order we can apply binary search in array ) so ans is D array Sanjay Sharma answered May 20, 2016 Sanjay Sharma comment Share Follow See all 7 Comments 7 7 Comments reply Sourabh Kumar commented May 20, 2016 reply Follow flag yeah, i think array is the answer but they give answer as linked list. 0 0 replyShare ManojK commented May 20, 2016 reply Follow flag https://gateoverflow.in/46266/algo 0 0 replyShare Sanjay Sharma commented May 21, 2016 reply Follow flag thanks shifting is bigger problem in array in comparison to searching position problem in linked list 0 0 replyShare Sourabh Kumar commented May 21, 2016 reply Follow flag But shifting is problem when deletion.but the question is about insertion. I think in insertion increasing in size at run time is the problem for large no. of element 0 0 replyShare Sanjay Sharma commented May 22, 2016 reply Follow flag how u can insert an element without shifting in an array it can be any position middle, beg etc 0 0 replyShare Sourabh Kumar commented May 22, 2016 reply Follow flag But we can do by set it up a variable.and each time on insertion we can increase this variable by pointing out the current location. 0 0 replyShare Sanjay Sharma commented May 22, 2016 reply Follow flag read question carefully there is an sorted array and the new element's location can be at any place say if it is at begining then u must shift all existing elements to right 0 0 replyShare Please log in or register to add a comment.
0 0 votes Ans : Array. If the answer is linked ist, then option should be doubly linked list. Mojo-Jojo answered May 21, 2016 Mojo-Jojo comment Share Follow 0 reply Please log in or register to add a comment.