The Flame-Free Confession Thread II

I am actually a bit disappointed that we don’t celebrate it here. Would be one more excuse to stuff myself with food and say I’m just celebrating.

We are beginning to near “duck sized bear” territory here

2 Likes

I confess, I like to sneak in a little workout Thanksgiving morning. Sometimes I’m a little late to the party.

I used to call that deadlift day.

I’ve actually wanted to do this for both Christmas and my birthday a few times and just never quite managed to fit it into other plans. I reckon it would help really pile the food in if you were hungrier for it.

I’ve rearranged family events and vacations to get workouts in - you’re fine

Leave 'em in the back of the fridge for a while then drop them on park benches around town in an intricately encrypted pattern.

I mean, “yeah! Turkey sammiches!”.

1 Like

I’m usually 10 pints in by the time the clock strikes midnight on Christmas Eve, which both tends to preclude the possibility of vigorous exercise on Christmas morning but also makes me incredibly hungry on Christmas day. Try that instead.

4 Likes

These days if I was 10 pints in, I wouldn’t see Christmas Day. :stuck_out_tongue_winking_eye:

2 Likes

What are you programming?

C.

The assignment was a piece of software that would simulate a library, adding books (using a sorted linked list) and allowing several actions like book search, borrowing and returning books, and printing the list of books and number of available copies.

I was having a few problems with the sorted insert function which was giving me a few segmentation fault errors due to null pointers’ attributes being accidentally tried to be accessed. I managed to fix it.

If you are meant to turn it in along with a reflection of some kind I’d remark that a linked list is not an appropriate datastructure for that use-case, and that a lookup-table of some kind would be far more appropriate.

We haven’t been taught that yet, and being that the exercise is based on our current knowledge from the course, which goes as far as linked lists and similar structures (like stacks), the options in terms of implementation were limited.

Moreover, the list is required to be sorted by author and then by title, but some of the functions require a search by author, whereas other features require the book be filtered by ISBN code, so a binary search cannot be directly implemented for the latter. I thought about simultaneously creating a second list, sorted by ISBN and with each node pointing to the corresponding node in the “main” list and calling a binary search function on that one when it is required to look up by ISBN, but that’s probably outside of the scope of the exercise. I might try an implement that for practice in the future though.

Right, I mean, when I was a tutor we never held it against students if they knew stuff that they have yet to learn as far as the curriculum is concerned.

While it is possible to binary search through a linked list, it’d been so much better if they’d taught you trees first. I can’t think of a great lifting analogy, but it’s like trying to teach someone how to squat by having them do a trap-bar deadlift.

Having a second list is a good idea. Another alternative, and this is basically modelling a search tree using arrays, would be to leverage that ISBNs are just a short sequence of digits, so you could have an array of arrays that ultimately resolves to a single book, so, you’d have

ISBN_list[9] point to another array of ten elements, so you could in effect do (for the ISBN 978-3-16-148410-0)

ISBN_list[9][7][8][3][1][6][1][4][8][1][0][0] which yields a pointer to the book struct you are looking for or NULL

1 Like

Man I really need to learn about trees.

Trees are great! But now I feel like we are hijacking this thread. @ me at anytime if you ever want to chat programming. My C is very rusty - and I don’t mean Rustlang-y. But when it comes to the more abstract stuff well that is always there. And given adequate time I can make sense of C still.

1 Like

Sure thing! Should you be curious by any means, I can have you have a look at the code for this program, so you can tell me how much it sucks on a scale from 1 to 10 haha. It’s 300+ lines of code though so I absolutely understand that no one would want to do it lol

That’s not too bad to be honest. Shoot it my way somehow. My email is in my bio. Or use pastebin or whatever. Might not have time today though

Don’t worry, I will need some time too because I kinda need to “translate” the code (they taught us everything using Italian names for variables and functions, and since they didn’t tell us anything about using English names being considered good or not in the exam, I took the safest path and did everything using Italian words). That should only take me a few find and replace, but I just finished working on another assignment so I don’t wanna see a keyboard until tomorrow lol.

In case you are curious, the other assignment was a program that would implement a calculator using reverse polish notation, in which the user would input multiple expressions, one per line, and the program would print the result (or “overflow”) for each line. I still need to finish it but the biggest chunk is done and I’m really satisfied.

[/hijack]

Ask before the next set of assignments if it’s okay to submit solutions in English. If you’ll be programming in industry or academia doing it in English is usually preferable, the only exemption being when you are,

  1. Working in a codebase already not in English, or
  2. Modelling a problem in which all the business domain knowledge is expressed in another language

So, for 2. you might find for instance if you were to program a system maintaining the course status, grades, etcetera. across all students attending universities in Italy as well as support some kind of “is it possible to take degree X given that a student has taken courses Y, Z,…”-functionality as there might be rules and regulations (and subsequently terminology) unique to Italy wherein translating the Italian words directly into English is confusing or obfuscation at best and flat-out wrong and misleading at worst.

1 Like