This is an improvement over last week, but you are doing only O(n^2) algorithms - not any of the O(n (log n)) ones.
Yes, you pass functions as pointers. But you also need to set up the type signature. Googling "c function pointer" gives for example https://www.geeksforgeeks.org/function-pointer-in-c/ which shows the sort of syntax needed.
I've put together a jupyter python notebook plot, turned that into an .html file so we can see it here easily, and did a screenshot.
$ jupyter notebook jim_plot.ipynb # edit & run it in a browser
$ jupyter nbconvert jim_plot.ipynb # create the .html file
In class I showed you demo_function_pointer.c and loop.c , and uploaded both here.
last modified | size | ||
bubbleSort.c | Sun Dec 22 2024 05:33 am | 2.8K | |
demo_function_pointer.c | Sun Dec 22 2024 05:33 am | 495B | |
insertion.c | Sun Dec 22 2024 05:33 am | 2.8K | |
jim_plot.html | Sun Dec 22 2024 05:33 am | 332K | |
jim_plot.ipynb | Sun Dec 22 2024 05:33 am | 77K | |
jim_plot.png | Sun Dec 22 2024 05:33 am | 258K | |
loop.c | Sun Dec 22 2024 05:33 am | 293B | |
results.csv | Sun Dec 22 2024 05:33 am | 551B | |
selection.c | Sun Dec 22 2024 05:33 am | 3.0K |