Question

41. True or False? Searching the components of an unordered list ADT is faster with a...

41. True or False? Searching the components of an unordered list ADT is faster with a linked list representation than with a direct array representation.

a) true

b) false

42. True or False? If an operation that allows random access to individual components of a list ADT is defined and occurs frequently, it is better to represent the list directly as an array than to use a linked list.

a) true

b) false

43. To prevent a compile-time error, how should the code be changed?

41. True or False? Searching the components of an

a) Insert the following before line 1:
typedef ListNode* NodeType*;

b) Insert the following before line 1:
struct ListNode; typedef ListNode* NodeType*;

c) Replace line 4 with the following:
ListNode* next;

d) Do either b or c above.

e) Do any of a, b, or c above.

44. Given the code fragment

struct Node Type

{

                                         int data;

                                        Node Type* next;

};

NodeType* p;

NodeType* q;

p = new NodeType;

p->data = 12;

p->next = NULL;

q = new NodeType;

q->data = 5;

q->next = p;


which of the following expressions has the value 12?

a) q

b) q->data

c) q->next->data

d) q->next

e) none of the above

45. If a program accidentally corrupts the next member of a node in the middle of a linked list, how much of the original linked list is now inaccessible?

a) only the corrupted node is inaccessible

b) all nodes preceding the corrupted node are inaccessible

c) all nodes following the corrupted node are inaccessible

d) the entire linked list is inaccessible

46. True or False? If currPtr points to a node in a dynamic linked list, the operation currPtr++ advances to the next node in the list.

a) true

b) false

47. True or False? With a list ADT, insertions and deletions at the back of the list are faster with a linked list representation than with a direct array representation.

a) true

b) false

48. True or False? The next item in a linked list always can be found by accessing the next physical location in memory.

a) true

b) false

49. True or False? An array-based list automatically gives you an O(1) length operation, but in a linked implementation the
length operation can be either O(1) or O(N) depending on the design decision.

a) true

b) false

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
41. True or False? Searching the components of an unordered list ADT is faster with a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Create Functions for the following prototypes. Below is the setup.*program is in c* #include <stdio.h> #include...

    Create Functions for the following prototypes. Below is the setup.*program is in c* #include <stdio.h> #include <string.h> #include <stdarg.h> #include <stdlib.h> //#define constant values #define MAX_URL_LENGTH 50 #define TRUE 1 #define FALSE 0 //typedef for the Element struct which constains a c string to store a URL in the BrowserList typedef struct { char szURL[MAX_URL_LENGTH]; } Element; //Typedef for a node in the doubly linked list (has next and previous pointers). typedef struct NodeDL { Element element; struct NodeDL *pNext;...

  • To solve real world problem, the programer uses ADT like list, stack, queue, set, map, ... etc. t...

    To solve real world problem, the programer uses ADT like list, stack, queue, set, map, ... etc. to build our data model. In AS8, we pick and choose STL queue and stack to build a postfix calculator. In this assignment you are to Design your own linked-list, a series of integer nodes. The private attributes of this IntLinked Queue including a integer node struct and private control variables and methods: private: struct Node { int data; Node *next; }; Node...

  • Programming in C: I am trying to modify this linked list to be doubly linked list....

    Programming in C: I am trying to modify this linked list to be doubly linked list. I’m also trying to add a print in reverse function. I’m really struggling with how to change the insert function to doubly link the nodes without effecting the alphabetical sorting mechanism. Example of desired output: Enter your choice: 1 to insert an element into the list. 2 to delete an element from the list. 3 to end. ? 1 Enter a character: a The...

  • Using the provided table interface table.h and the sample linked list code linkedList.c, complete an implementation...

    Using the provided table interface table.h and the sample linked list code linkedList.c, complete an implementation of the Table ADT. Make sure that you apply the concepts of design by contract (DbC) to your implementation. Once you have fully implemented the table, create a main.c file that implements a testing framework for your table. Your table implementation must ensure that values inserted are unique, and internally sorted within a linked list. table.h #ifndef _TABLE_H #define _TABLE_H //----------------------------------------------------------------------------- // CONSTANTS AND...

  • Codelab question! This is c++. Consider the following code: // Linked Lists: TRAVERSE struct ListNode {...

    Codelab question! This is c++. Consider the following code: // Linked Lists: TRAVERSE struct ListNode { int data; struct ListNode *next; }; Assume that a linked list has been created and head points to a sentinel node. A sentinel node is an empty data node in the beginning of the list. It sometimes holds a sentinel value. The use of sentinel nodes is a popular trick to simplify the insert and delete operations. You may also assume that the list...

  • true or false A linked list is a list of items, called nodes, in which the...

    true or false A linked list is a list of items, called nodes, in which the order is determined by the address, called of the nodes 1. 2. The pointer to a linked list-that is, the pointer to the first node in the list-is stored in a separate location called the head or first. 3. A linked list is a dynamic data structure.

  • 14.   p contains the elements 66, 9, 14, 52, 87, 14 and 17, in that order....

    14.   p contains the elements 66, 9, 14, 52, 87, 14 and 17, in that order. Consider running the following line of code: p = question4(p); where question4 is the function defined below. Show the contents of p after the function call. struct node* question4(struct node *list) { struct node* a = list; struct node* b = list; struct node* c; if (a == NULL) return NULL; while ( a->next != NULL) a = a ->next; a->next = b; c...

  • 14.   p contains the elements 66, 9, 14, 52, 87, 14 and 17, in that order....

    14.   p contains the elements 66, 9, 14, 52, 87, 14 and 17, in that order. Consider running the following line of code: p = question4(p); where question4 is the function defined below. Show the contents of p after the function call. struct node* question4(struct node *list) { struct node* a = list; struct node* b = list; struct node* c; if (a == NULL) return NULL; while ( a->next != NULL) a = a ->next; a->next = b; c...

  • Enum {FALSE=0, TRUE}; #define MAXBUFF 1024 #define SMALLBUFF 10 /* The LinkNode type is used as a...

    enum {FALSE=0, TRUE}; #define MAXBUFF 1024 #define SMALLBUFF 10 /* The LinkNode type is used as an element of a linked list ** implementation of a stack of tree nodes. */ typedef struct link_t LinkNode; typedef LinkNode *LinkNodePtr; /* The TreeNode type is used as an element of a binary "parse" tree. ** Tree nodes are created while parsing the RPN expression and ** stored on a stack until it's time to place them. */ typedef struct tree_t TreeNode; typedef...

  • C++ pointers and linked lists 1. Declare an integer pointer variable intPointer. Initialize it to point...

    C++ pointers and linked lists 1. Declare an integer pointer variable intPointer. Initialize it to point to an int variable named someInt. Assign the value 451 to someInt and output (cout) the variable someInt and output (cout) the value pointed to by intPointer. Write an assignment statement that indirectly stores 900 into the value pointed to by intPointer. Output (cout) the value pointed to by intPointer and output (cout) the variable someInt, 2. Declare a pointer variable charArrPointer and initialize...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT