logo

Crowdly

Browser

Додати до Chrome

Questions Bank (1527139 total)

The objective is to compute the statistics of Test-2 of Coding Cafe - in terms of the highest score, lowest score and the average score. Please study the following main() function, which calls another function called getStats() in line 11:

  1 #include <stdio.h>

  2 #define MAX 186

  3 

  4 int main()

  5 {

  6   float test1[MAX];

  7   float highest,lowest,average;

  8   for (i=0; i<MAX; ++i)

  9     scanf("%d", &test1[i]);

 10 

 11   getStats(test1, &highest, &lowest, &average);

 12   printf("%f %f %f\n", highest, lowest, average);

 13 

 14   return 0;

 15 }                                                                     

(a) Write the function declaration (prototype) of getStats() function. No need to write the body of the function.

(b) Instead of the current version of line 11, suppose the function was invoked by writing

getStats(test1, highest, lowest, average); 
would it make any difference to the way the program works? Explain your answer.

Переглянути це питання

In less than 10 words, state what the following function does:

void strmanip(char a[]) /* receives a string as its argument */

{ 

  char *b, temp;

  b = a + strlen(a) - 1;        

  for (  ; a < b ; a++, b--)            

  {                     

          temp = *a;

          *a = *b;

          *b = temp;

  }     

  return;

}

Переглянути це питання

Write a single statement using the ternary operator (? : ) to find out the maximum of three numbers (stored in variables a, b and c) and store the result should in a variable called max.

Переглянути це питання

Військовозобов’язаним,

які підлягають бронюванню згідно з переліками посад і професій, ТЦК та СП

(органами СБУ, СЗР) за місцем розташування органів державної влади, інших

державних органів, органів місцевого самоврядування, підприємств, установ,

організацій оформлюються:

❌
❌
✅
❌
Переглянути це питання

Quel est le message essentiel contenu dans l’article du journal ?

100%
0%
0%
0%
Переглянути це питання

Comment insère-t-on un nouvel élément dans un arbre binaire de recherche (BST) ?

How do you insert a new element into a binary search tree (BST)?

0%
0%
0%
0%
Переглянути це питання

Nous avons demandé à ChatGPT la définition d'un arbre binaire balancé.

Voici sa réponse (nous avons ajouté la structuration pour les questions) : 

A) Un arbre binaire équilibré est un type d'arbre binaire dans lequel la différence de hauteur entre les sous-arbres gauche et droit de chaque nœud est limitée à une constante, généralement 1. Cela signifie que pour chaque nœud de l'arbre, la hauteur du sous-arbre gauche et la hauteur du sous-arbre droit diffèrent au plus d'une unité.

B) Plus formellement, un arbre binaire équilibré est un arbre binaire dans lequel la différence de hauteur entre le sous-arbre gauche et le sous-arbre droit de chaque nœud est au plus 1 et les sous-arbres gauche et droit sont eux-mêmes des arbres binaires balancés.

C) L'équilibrage d'un arbre binaire est important, car il garantit que les opérations telles que l'insertion, la suppression et la recherche peuvent être effectuées en temps logarithmique par rapport au nombre de nœuds dans l'arbre, assurant ainsi des performances efficaces dans les structures de données basées sur des arbres binaires comme les arbres de recherche binaires (BST) ...

Quelles propositions sont vraies ? 

----

Version en anglais -

We asked ChatGPT for the definition of a balanced binary tree.

Here is his answer (we've added the structure in the answers):

A) A balanced binary tree is a type of binary tree in which the height difference between the left and right subtrees of each node is bounded by a constant, usually 1. This means that for each node in the tree, the height of the left subtree and the height of the right subtree differ by at most one unit.

B) More formally, a balanced binary tree is a binary tree in which the height difference between the left and right subtrees of each node is at most 1, and the left and right subtrees are themselves balanced binary trees.

C) Balancing a binary tree is important because it ensures that operations such as insertion, deletion, and search can be performed in logarithmic time relative to the number of nodes in the tree, thus ensuring efficient performance in binary tree-based data structures such as binary search trees (BSTs).

Which statements are true?

0%
0%
0%
0%
0%
0%
0%
Переглянути це питання

Soit un BST T et 2 éléments distincts x et y qui ne sont pas dans T.

On note :

  • Tx,y le BST obtenu par insertion des 2 éléments dans l'ordre x puis y
  • Ty,x le BST obtenu par insertion des 2 éléments dans l'ordre y puis x.

Version en anglais :

Consider a BST T and two distinct elements x and y that are not in T

Let:

Tx,y be the BST obtained by inserting the two elements in order x then y

Ty,x  be the BST obtained by inserting the two elements in order y then x.

✅
❌
❌
Переглянути це питання

До якої національної літератури належить творчість Милорада Павича?

❌
✅
❌
❌
Переглянути це питання

Старий із повісті Е. Гемінґвея «Старий і море» не зловив жодної рибини протягом…

✅
❌
❌
❌
Переглянути це питання