Академический Документы
Профессиональный Документы
Культура Документы
2. How a two-dimensional array can be represented in computer’s memory? Explain with example.
Ans: The memory of a computer is linear and not a matrix like a 2D array. So, the elements of the array are stored either
by row, called "row-major", or by column, called "column-major". Row-major order is used most notably in C and C++
during static declaration of arrays.
In C, since the length of each row is always known, the memory can be filled row one row at a time, one after the other.
Example: a[i][j] = 1 2 3 4 5 6 7 8 9
Representation in the memory:
In row-major: 1 2 3 4 5 6 7 8 9
In column-major: 1 4 7 2 5 8 3 6 9
iii Elements Each item of a array is called a index. Each item of a record is called a field or attribute.
A linked list whose nodes contain two fields: an integer value and a link to the next node
Each algorithm is a list of well-defined instructions for completing a task. Starting from an initial state, the instructions
describe a computation that proceeds through a well-defined series of successive states, eventually terminating in a final
ending state.
____________________________________________________________________________________________
A program is a specific set of ordered operations for a computer to perform. In the modern computer that John von
Neumann outlined in 1945, the program contains a one-at-a-time sequence of instructions that the computer follows.
Typically, the program is put into a storage area accessible to the computer. The computer gets one instruction and
performs it and then gets the next instruction. The storage area or memory can also contain the data that the instruction
operates on. (Note that a program is also a special kind of "data" that tells how to operate on "application or user data."
A doubly-linked list whose nodes contain three fields: an integer value, the link forward to the next node, and the link backward to the previous node
b) How a two-dimensional array can be represented in computer’s memory? Explain with example.
Circular Linked List: In the last node of a Linear linked list, the link field often contains a null reference, a special value that is
interpreted by programs as meaning "there is no such node". A less common convention is to make it point to the first node of the list; in