Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Ans-:
A linked list can be compared with a necklace. When we find that we don't like any of the jewel
anymore, we take it out of the sequence and tie the resulting two ends together. There is no need
to loop through each pearl and displace it just so you can fix your necklace.
It is used in operating systems. One may use a linked list to keep track of what processes are
running and what processes are sleeping. A process that is running and wants to sleep gets
removed from the Linked List that keeps track of running processes and once the sleep time is
over adds it back to the active process Linked List
if N1<A[M]
(End of loop 2)
Print N2
Exit
Ans-: Yes, we can create a new data structure. It depends on the user how to make programming code
there are various steps that can result into creation of a new data structure.
Q5. Compare and contrast the Arrays and pointer Arrays. How record structures are accessed by the use
of pointer Arrays?
Ans-: A pointer is an address in memory where a variable is located. An array is a conceptual data
representation consisting of a list of more than one item of a particular scalar type (int, float, char,
structure, etc.) where each element is accessed by its index. The index can be thought of as a counter or
enumerator telling you how many elements you have to skip over to get to the one you're interested in.
Here's where addresses come in ... the location of a particular element in memory is offset from the so-
called base address (i.e. the address of the starting element) by the value (sizeof(one element) * index #)
The C compiler is smart enough to take the sizeof() into account when you do pointer arithmetic, so you
can find the address of the i-th element as (address of base) + i, rather than having to do the multiplication
explicitly. The idea of element address as offset also accounts for C's use of zero-relative array
definitions. Since the first element is offset by 0 positions from the first element its index in C is 0, not 1.
The second (ordinal) element is offset from the first by 1 position so its index is 1, and so on.
Record structures are accessed by the use of pointer Arrays as Computing applications often need data of
different kinds to be associated. A typical place where this occurs is in a record. For example a database
record for a particular student might contain the student number, full name, course-code and year of entry.
struct bank
{
char name[25];
char branch[100];
char acc no[16];
int year_established;
};
g(n)
log n n log nⁿ n log n
n
5 3 5 243 124
10 4 10 10⁶ 10⁴
From above table we find that g(n)= log nⁿ grows faster than g(n)= n log n