473,396 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Linked List - M-Choice Question

Assume a linked list of nodes which have an info data member and a
next data member. Suppose a pointer called cursor points to a node in
the middle of the linked list. To move ptr to the next node use:
ptr=next;
next->ptr;
ptr->next;
ptr=ptr->next;
none of the above.

I want to anwser none of the above as i feel it should be cursor-
>next; But I could also anwser ptr->next; if I disregard the info
leading up to last sentacne which is the actual question (To move ptr
to the next node use:). is this a trick question, or am i reading to
much into it?
Jun 27 '08 #1
4 1188
"yogi_bear_79" writes:
Assume a linked list of nodes which have an info data member and a
next data member. Suppose a pointer called cursor points to a node in
the middle of the linked list. To move ptr to the next node use:
ptr=next;
next->ptr;
ptr->next;
ptr=ptr->next;
none of the above.

I want to anwser none of the above as i feel it should be cursor-
>>next; But I could also anwser ptr->next; if I disregard the info
leading up to last sentacne which is the actual question (To move ptr
to the next node use:). is this a trick question, or am i reading to
much into it?
My guess is that is not meant to be a trick question, just a question posed
by somene who has difficulty saying what he means. "Suppose a pointer
called cursor... " There is no such pointer in the code. Did he mean "To
change ptr to point to the next node?" That isn't what he says, is it?
Jun 27 '08 #2
On 2008-05-03 17:58, yogi_bear_79 wrote:
Assume a linked list of nodes which have an info data member and a
next data member. Suppose a pointer called cursor points to a node in
the middle of the linked list. To move ptr to the next node use:
ptr=next;
next->ptr;
ptr->next;
ptr=ptr->next;
none of the above.

I want to anwser none of the above as i feel it should be cursor-
>>next; But I could also anwser ptr->next; if I disregard the info
leading up to last sentacne which is the actual question (To move ptr
to the next node use:). is this a trick question, or am i reading to
much into it?
If we assume that it is not a trick question the correct answer is 4
(ptr=ptr->next). If it is a trick question (which I doubt) then the
correct answer is 5 (none of the above), just like you said.

--
Erik Wikström
Jun 27 '08 #3
yogi_bear_79 wrote:
Assume a linked list of nodes which have an info data member and a
next data member. Suppose a pointer called cursor points to a node in
the middle of the linked list. To move ptr to the next node use:
ptr=next;
next->ptr;
ptr->next;
ptr=ptr->next;
none of the above.

I want to anwser none of the above as i feel it should be cursor-
>next; But I could also anwser ptr->next; if I disregard the info
leading up to last sentacne which is the actual question (To move ptr
to the next node use:). is this a trick question, or am i reading to
much into it?
My guess is that its a typographical error, and that they intented "ptr"
and "cursor" to be the same thing. I'd suggest trying to get
clarification if possible.

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Jun 27 '08 #4
On May 3, 1:14*pm, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.netwrote:
yogi_bear_79 wrote:
Assume a linked list of nodes which have an info data member and a
next data member. *Suppose a pointer called cursor points to a node in
the middle of the linked list. *To move ptr to the next node use:
ptr=next;
next->ptr;
ptr->next;
ptr=ptr->next;
none of the above.
I want to anwser none of the above as i feel it should be cursor-
next; *But I could also anwser ptr->next; if I disregard the info
leading up to last sentacne which is the actual question (To move ptr
to the next node use:). *is this a trick question, or am i reading to
much into it?

My guess is that its a typographical error, and that they intented "ptr"
and "cursor" to be the same thing. *I'd suggest trying to get
clarification if possible.

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>- Hide quoted text -

- Show quoted text -
I'd imagine it is not supposed to be a trick. Asking for clarification
has proved pointless. This is the second of four tests. I asked for
clarification after I took the first one, and received nada. The tests
are extremely badly written. They are not in the text book.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jeffrey Silverman | last post by:
Hi, all. I have a linked list. I need an algorithm to create a tree structure from that list. Basically, I want to turn this: $list = array( array( 'id' => 'A', 'parent_id' => null, 'value'...
7
by: Chris Ritchey | last post by:
Hmmm I might scare people away from this one just by the title, or draw people in with a chalange :) I'm writting this program in c++, however I'm using char* instead of the string class, I am...
11
by: C++fan | last post by:
Suppose that I define the following class: class example_class{ public: example_class(); void funtion_1(); void function_2(); protected:
5
by: Dream Catcher | last post by:
1. I don't know once the node is located, how to return that node. Should I return pointer to that node or should I return the struct of that node. 2. Also how to do the fn call in main for that...
5
by: John N. | last post by:
Hi All, Here I have a linked list each containing a char and is double linked. Then I have a pointer to an item in that list which is the current insertion point. In this funtion, the user...
6
by: Steve Lambert | last post by:
Hi, I've knocked up a number of small routines to create and manipulate a linked list of any structure. If anyone could take a look at this code and give me their opinion and details of any...
12
by: joshd | last post by:
Hello, Im sorry if this question has been asked before, but I did search before posting and couldnt find an answer to my problem. I have two classes each with corresponding linked lists, list1...
51
by: Joerg Schoen | last post by:
Hi folks! Everyone knows how to sort arrays (e. g. quicksort, heapsort etc.) For linked lists, mergesort is the typical choice. While I was looking for a optimized implementation of mergesort...
1
by: theeverdead | last post by:
Ok I have a file in it is a record of a persons first and last name. Format is like: Trevor Johnson Kevin Smith Allan Harris I need to read that file into program and then turn it into a linked...
0
by: Atos | last post by:
SINGLE-LINKED LIST Let's start with the simplest kind of linked list : the single-linked list which only has one link per node. That node except from the data it contains, which might be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.