1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
KengaRu [80]
4 years ago
9

Consider designing a program where you need to store information about every student ASU. You need to be able to quickly determi

ne which students are graduating this semester. Would you use an array or linked list? Analyze the problem, design a choice, and justify the choice
Computers and Technology
1 answer:
gulaghasi [49]4 years ago
6 0

Answer:

Check the explanation

Explanation:

Both Arrays and Linked List can be used to store linear data of similar types, but they both have some advantages and disadvantages over each other. To store information about every student we can use an array

Reason:

In the array the elements belong to indexes, i.e., if you want to get into the fourth element you have to write the variable name with its index or location within the square bracket.

In a linked list though, you have to start from the head and work your way through until you get to the fourth element.

Accessing an element in an array is fast, while Linked list takes linear time, so it is quite a bit slower.

Example: store the data of students and have faster access and this program in example also do sorting

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

// struct person with 3 fields

struct Student {

   char* name;

   int id;

   char age;

};

// setting up rules for comparison

// to sort the students based on names

int comparator(const void* p, const void* q)

{

   return strcmp(((struct Student*)p)->name,

                 ((struct Student*)q)->name);

}

// Driver program

int main()

{

   int i = 0, n = 5;

   struct Student arr[n];

   // Get the students data

   arr[0].id = 1;

   arr[0].name = "bd";

   arr[0].age = 12;

   arr[1].id = 2;

   arr[1].name = "ba";

   arr[1].age = 10;

   arr[2].id = 3;

   arr[2].name = "bc";

   arr[2].age = 8;

   arr[3].id = 4;

   arr[3].name = "aaz";

   arr[3].age = 9;

   arr[4].id = 5;

   arr[4].name = "az";

   arr[4].age = 10;

   // Print the Unsorted Structure

   printf("Unsorted Student Records:\n");

   for (i = 0; i < n; i++) {

       printf("Id = %d, Name = %s, Age = %d \n",

              arr[i].id, arr[i].name, arr[i].age);

   }

   // Sort the structure

   // based on the specified comparator

   qsort(arr, n, sizeof(struct Student), comparator);

   // Print the Sorted Structure

   printf("\n\nStudent Records sorted by Name:\n");

   for (i = 0; i < n; i++) {

       printf("Id = %d, Name = %s, Age = %d \n",

              arr[i].id, arr[i].name, arr[i].age);

   }

   return 0;

}

Output:

Unsorted Student Records: Id = 1, Name = bd, Age = 12 Id = 2, Name = ba, Age = 10 Id = 3, Name = bc, Age = 8 Id = 4, Name = aaz, Age = 9 Id = 5, Name = az, Age = 10

You might be interested in
What is meaning of reboot
TEA [102]
I believe to reboot is to reset. Its the act of resetting, or starting up a computer again.
4 0
4 years ago
Read 2 more answers
The _____ constraint assigns a value to an attribute when a new row is added to a table
bixtya [17]

The default constraint gives a value to an attribute when a new row is added to a table.

<h3>Is default a kind of constraint?</h3>

This is known to be a type of constraint that often apply a value to a column if an INSERT statement does not really give the value for the column.

Therefore, one can say that the default constraint gives a value to an attribute when a new row is added to a table.

Learn more about default constraint from

brainly.com/question/19130806

#SPJ12

5 0
2 years ago
All computers can support multiple internal hard drives. <br><br> a. True <br><br> b. False
lara31 [8.8K]
False.  Some can, but some do not have space for them.  Please mark Brainliest!!!
5 0
3 years ago
What do I do if someone wants to be my friend, and I don’t know who the person is online?
prohojiy [21]
Tell someone you're close to, and see what advice they have. It's best to ignore the person until then.
8 0
3 years ago
Read 2 more answers
The various online technology tools that enable people to communicate easily via the Internet to share information and resources
seropon [69]

Answer:

Social media is the correct answer for the above question.

Explanation:

  • Social media is the media that is used to communicate with the other person with the help of an internet connection. There is so much software that gives this type of facility. for example whats up and twitter.
  • The above question asked about that technology which is used to connect the people to communicate and the technology is social media which gives the features to connect and communicate all over the world with the help of the internet. Hence "Social media" is the correct answer.
8 0
3 years ago
Other questions:
  • I want to work on cloud computing and i need some help on how to start ?
    6·1 answer
  • why does it not let me create a new account when i log out of this one and go to join now after i fill everything out it wont le
    11·1 answer
  • A user contacted the help desk to report that the laser printer in his department is wrinkling the paper when printed. The user
    5·1 answer
  • When you send an email to your professor, a server holds that email until the professor requests it.
    8·1 answer
  • WILL UPVOTE ALL
    10·1 answer
  • How does an individual's access to a wide range of online services affects their ability to operate safely in the digital world.
    5·1 answer
  • Which task is not possible with VLOOKUP?
    10·2 answers
  • If any one answered this i will give brilientst what is stimulation program​
    6·1 answer
  • Assume the size of an integer array is stored in $s0 and the address of the first element of the array in the memory is stored i
    10·1 answer
  • A leading global vendor of computer software, hardware for computer, mobile and gaming systems, and
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!