31. Which code segment will correctly add a nar to a team roster? Assume all variables and lists are appropriate initialized. Block 1 REPEAT UNTIL (x <= 0) ( } Block 2 APPEND (roster, name) x+x+1 FOR EACH nane IN roater ( APPEND (roster, nane) DISPLAY (name) } (A) Block 1 (B) Block 2 (C) Both Block 1 and Block 2 (D) Neither Block 1 or Block 2 32. Which algorithm will determine if a number even? (A) num INPUT ( ) IF (num MOD 2 = 0) } (D) num DISPLAY (num, is even") (B) Assume list is initialized with integers. FOR Each nun IN list IF (num/ 2 = 0) ( } DISPLAY (num, is even") num INPUT( ) IF ((num 21. num - num) DISPLAY (num, is even") INPUT( ) IF (NOT (num MOD 2 - 0)) ( DISPLAY(num, is even")
Types of Linked List
A sequence of data elements connected through links is called a linked list (LL). The elements of a linked list are nodes containing data and a reference to the next node in the list. In a linked list, the elements are stored in a non-contiguous manner and the linear order in maintained by means of a pointer associated with each node in the list which is used to point to the subsequent node in the list.
Linked List
When a set of items is organized sequentially, it is termed as list. Linked list is a list whose order is given by links from one item to the next. It contains a link to the structure containing the next item so we can say that it is a completely different way to represent a list. In linked list, each structure of the list is known as node and it consists of two fields (one for containing the item and other one is for containing the next item address).



Trending now
This is a popular solution!
Step by step
Solved in 5 steps









