Professional Documents
Culture Documents
Dsa Assignment 1 21102028 Gurnoor Chhabra
Dsa Assignment 1 21102028 Gurnoor Chhabra
Ans :
Images are the collection of pixels, images are 2-dimensional entities so an arrangement of pixels
in 2-dimensional space represnts an image.
Each pixels contains information of corresponding value of rgb according to that gives colour on
screen.
we can make use of 2-D array data structure and structures where each pixel as struct node
which contains rgb information and to repensent complete image we will make 2-dimensional
array of structure.
Time complexity to store the images are O(n*m) where n is the number of rows and m is number
of columns in 2-d array
We can also use linked list, trees and graphs to store images.
Q2 : You’re given the pointer to the head nodes of two linked lists. Compare the data in the nodes
of
the linked lists to check if they are equal. If all data attributes are equal and the lists are the same
// Driver Code
int main()
{
/* The constructed linked lists are :
a: 3->2->1
b: 3->2->1 */
struct Node* a = NULL;
struct Node* b = NULL;
push(&a, 1);
push(&a, 2);
push(&a, 3);
push(&b, 1);
push(&b, 2);
push(&b, 3);
// Function call
if (areIdentical(a, b))
cout << "Identical";
else
cout << "Not identical";
return 0;
}