- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
Most frequent element2 #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
        
          
                semester_1/homework1/substring.c
              
                Outdated
          
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В PR не должно быть изменений в файлах, не связанных с задачей.
| #include <stdbool.h> | ||
| #include <stdlib.h> | ||
|  | ||
| int mostFrequentElement(int array[], int size); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Принято передавать массив в функцию по указателю
Размеры и индексы храним в size_t.
| void printArray(int array[], int size); | ||
|  | ||
| bool test(void); | ||
| bool testStarterForMostFrequentELement(int testArray[], int size, int answer); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testStarter -> testCase
| bool testStarterForMostFrequentELement(int testArray[], int size, int answer); | ||
| bool testMostFrequentElementFunction(void); | ||
|  | ||
| int main() | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main(void)
| if (!test()) | ||
| { | ||
| printf("\nSorry but the program does not work correctly\n"); | ||
| return 1; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
коды ошибок и возврата выносим в define
| if (rightElement < leftElement) | ||
| { | ||
| return 2; | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
убрать
| if (errorCode != 0) | ||
| { | ||
| return 1; | ||
| } | ||
| return 0; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
убрать
| smartQuickSort(array, currentSeparator + 1, rightElement); | ||
| } | ||
| return 0; | ||
| } No newline at end of file | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Перенос строки в конце файла
| int smartQuickSort(int array[], int leftElement, int rightElement); | ||
|  | ||
| // a function for testing the work of quick sort | ||
| bool testSmartQuickSort(void); No newline at end of file | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Перенос строки в конце файла
| return true; | ||
| } | ||
|  | ||
| bool testSmartQuickSortFunction(void) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static и все функции, которые не нужны вне модуля делаем static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
решение этой задачи должно быть в отдельной папке, не связанной с задачей самый частый элемент
        
          
                semester_1/homework1/substring.c
              
                Outdated
          
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
убрать из PR все файлы не связанные с задачей
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут не должно быть изменений в других файлах, не надо удалять сами файлы.
сейчас после заливки этого PR в main удалятся старые решения, такого быть не должно
научиться делать git rebase и исправить/удалить все коммиты, в которых добавлялись / удалялись эти файлы.
| return testSmartQuickSort() && testMostFrequentElement(); | ||
| } | ||
|  | ||
| ExitCode main() | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int main(void)
| && mostFrequentElement(testArray2, testSize2) == answer2 | ||
| && mostFrequentElement(testArray3, testSize3) == answer3; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
отступы выровнять: все строки после первой на 4 пробела дальше, чем первая
| return memcmp(testArray1, answerArray1, testSize1) == 0 | ||
| && memcmp(testArray2, answerArray2, testSize2) == 0 | ||
| && memcmp(testArray3, answerArray3, testSize3) == 0; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут тоже
No description provided.