linked-list Questions
19
Solved
This is one of the programming questions asked during written test from Microsoft. I am giving the question and the answer that I came up with. Thing is my answer although looks comprehensive (at l...
Travers asked 27/2, 2010 at 18:0
9
Solved
How should I implement a linked list in PHP? Is there a implementation built in into PHP?
I need to do a lot of insert and delete operations, and at same time I need to preserve order.
I'd like ...
Byerly asked 2/9, 2010 at 20:28
9
Solved
I have this code below where I am inserting a new integer into a sorted LinkedList of ints but I do not think it is the "correct" way of doing things as I know there are singly linkedlist with poin...
Peraea asked 9/8, 2013 at 10:37
7
What are some possible ways to implement a linked list in MATLAB?
Note: I am asking this question for pedagogical value, not practical value. I realize that if you're actually rolling your own lin...
Ramah asked 12/9, 2009 at 0:31
11
Solved
I am trying to to understand why Java's ArrayDeque is better than Java's LinkedList as they both implement Deque interface.
I hardly see someone using ArrayDeque in their code. If someone sheds m...
Grisaille asked 28/5, 2011 at 17:16
3
Solved
I have a singly-linked-list, L, and create a pointer to this list P. It seems like sometimes modifying P changes the actual list, while other times modifying P does nothing to the actual list L and...
Furfur asked 8/11, 2019 at 1:53
1
Solved
In libstdc++ and libc++ the internal nodes for lists (e.g. list and forward_list) and other trees are constructed in (at least) two parts: a node base class; and the node class itself. For example,...
Kerley asked 27/5, 2020 at 8:58
15
Solved
According to the Wikipedia article on linked lists, inserting in the middle of a linked list is considered O(1). I would think it would be O(n). Wouldn't you need to locate the node which could be ...
Malachy asked 8/5, 2009 at 16:21
7
Solved
So I'm fairly new to C++ and today I decided to sit down and understand how linked lists work. I'm having a lot of fun doing it so far, but I've encountered a problem when trying to print my linked...
Manion asked 5/1, 2013 at 22:58
5
Solved
In Java, how to remove all the elements in linked list without using already available clear() method? This exercise was inspired by a question received in a phone interview.
Say I can do this in ...
Fye asked 14/4, 2011 at 4:16
16
Solved
I use a lot of lists and arrays but I have yet to come across a scenario in which the array list couldn't be used just as easily as, if not easier than, the linked list. I was hoping someone could ...
Tarango asked 26/12, 2008 at 6:52
34
Solved
I've always been one to simply use:
List<String> names = new ArrayList<>();
I use the interface as the type name for portability, so that when I ask questions such as this, I can rewor...
Pestalozzi asked 27/11, 2008 at 1:36
34
Solved
I've always been one to simply use:
List<String> names = new ArrayList<>();
I use the interface as the type name for portability, so that when I ask questions such as this, I can rewor...
Sophistic asked 27/11, 2008 at 1:36
34
Solved
I've always been one to simply use:
List<String> names = new ArrayList<>();
I use the interface as the type name for portability, so that when I ask questions such as this, I can rewor...
Frankly asked 27/11, 2008 at 1:36
5
Solved
I'm working in linked lists in Java, so I'm trying to grasp the concept of a single linked list.
head -> 12 -> 34 -> 56 -> null
head.next would be 12 (also the same as node1). However...
Centigrade asked 11/2, 2011 at 20:30
16
Solved
When is it better to use a List vs a LinkedList?
Transonic asked 4/10, 2008 at 8:23
16
Solved
When is it better to use a List vs a LinkedList?
Drank asked 4/10, 2008 at 8:23
16
Solved
When is it better to use a List vs a LinkedList?
Fluorite asked 4/10, 2008 at 8:23
3
Solved
I m new to Java Collections and my doubt is why can't i traverse a element in linkedlist in backward directions.Below I'll explain what i did and please clarify my doubts.
I've created interface ...
Americaamerican asked 13/9, 2015 at 5:26
4
Solved
In Java's LinkedList implementation, I see two methods which seems to me like having identical functions.
getFirst() --Returns the first element in this list.
peekFirst() --Retrieves, but does no...
Yeorgi asked 29/5, 2014 at 7:17
35
I understand the definition of a Linked List, but how can it be represented and related to a common concept or item?
For example, composition (EDIT: originally said 'inheritance') in OOP can be r...
Sake asked 13/3, 2009 at 19:9
6
Solved
I have only been using raw pointers for linked list with templates. For example, the member data, Node<T>* head; and when I am inserting a node one of the lines would be head = new Node<T&...
Draconian asked 17/4, 2016 at 6:30
6
Solved
How will I free the nodes allocated in another function?
struct node {
int data;
struct node* next;
};
struct node* buildList()
{
struct node* head = NULL;
struct node* second = NULL;
struct...
Ebarta asked 20/6, 2011 at 20:34
20
I was recently brushing up on some fundamentals and found merge sorting a linked list to be a pretty good challenge. If you have a good implementation then show it off here.
Alter asked 11/8, 2008 at 11:43
30
Solved
The following function is trying to find the nth to last element of a singly linked list.
For example:
If the elements are 8->10->5->7->2->1->5->4->10->10 then the res...
Krug asked 8/4, 2010 at 8:3
1 Next >
© 2022 - 2024 — McMap. All rights reserved.