what is the difference between arrays and linked list
Answer Posted / shruti
the main differance between arrays and linked list is:
In array we follow static memory allocation.
i.e we assign memory to the particular element in advance.
in linked list -> dynamic memory allocation.
i.e we assign memory to the particular element at run-time..
hence we reserve only the amount of memory which is
required.
there is no problem of memory shortage or wastage, in
linked list. which we very frequently come accross in the
arrays..
Is This Answer Correct ? | 137 Yes | 21 No |
Post New Answer View All Answers
You have given 2 array. You need to find whether they will
create the same BST or not.
For example:
Array1:10 5 20 15 30
Array2:10 20 15 30 5
Result: True
Array1:10 5 20 15 30
Array2:10 15 20 30 5
Result: False
One Approach is Pretty Clear by creating BST O(nlogn) then
checking two tree for identical O(N) overall O(nlogn) ..we
need there exist O(N) Time & O(1) Space also without extra
space .Algorithm ??
DevoCoder
guest
Posted 3 months ago #
#define true 1
#define false 0
int check(int a1[],int a2[],int n1,int n2)
{
int i;
//n1 size of array a1[] and n2 size of a2[]
if(n1!=n2) return false;
//n1 and n2 must be same
for(i=0;i
What is declaration and definition in c?
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
What is the explanation for cyclic nature of data types in c?
Explain the difference between structs and unions in c?
Explain how do you determine the length of a string value that was stored in a variable?
What is static function in c?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode
Is it possible to use curly brackets ({}) to enclose single line code in c program?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
What are the primitive data types in c?
Explain output of printf("Hello World"-'A'+'B'); ?
What is an auto keyword in c?
Is calloc better than malloc?