Can you share exercises/assignments of programming?

  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Programming
AI Thread Summary
The discussion centers around self-learning programming concepts, specifically focusing on arrays and strings, with a request for exercises to improve coding skills before tackling data structures and algorithms (DSA) on platforms like LeetCode and Codewars. A design document for a RingBuffer implementation is shared, detailing its structure and methods for managing a circular buffer in a multi-threaded environment without library dependencies. Helpful resources include Wes Bos's 30 Days of JavaScript and FreeCodeCamp's beginner projects. Suggested exercises aim to reinforce understanding of arrays and functions, such as finding the largest number in an array, filtering strings by length, and implementing array manipulations using loops and built-in functions like map, filter, and reduce. The importance of practice is emphasized, with encouragement to seek help in relevant forums if challenges arise.
shivajikobardan
Messages
637
Reaction score
54
TL;DR Summary
exercises
I've finished self-learning till arrays. Learning about strings today. My level isn't that high yet that I will be able to solve DSA problems in leetcode and codewars imo. So, I want some exercises. If some of you have access to university's assignments and are eligible to share it, please share it. Or some other exercises are also ok.
 
Technology news on Phys.org
Here is a design document I wrote for a teenager some years ago:
Design Document For RingBuffer
Basic object:
[CODE lang="c" title="RingBuffer"]Ringbuffer: Object {
private
char buf[];
int buf_size, put_on, take_off;
bool empty, full;
int init(int size);
int next(int ix);
public
int put(char ch);
int get(void);
}
[/CODE]
Design Details
init
  1. Allocate space for buf[]
  2. Set buf_size, put_on and take_off to initial values (find out)
  3. Set empty to TRUE and full to FALSE
next
return (ix+1) if ix<buf_size, otherwise return 0
put
If full
return -1
else
Copy ch to buf[put_on]
Update put_on
Set empty to FALSE
if put_on equals take_off set full to TRUE
return 0
get
if empty
return -2
else
copy buf[take_off] to temp
update take_off
Set full to FALSE
if put_on equals take_off set empty to TRUE
return temp
Constraints
The Ringbuffer module is supposed to be a part of a multi-threaded program. It cannot rely on any libraries.
 
  • Like
Likes shivajikobardan
Update: These are the helpful things that I found from my research.

1) Wes bos 30 days of javascript.
2) https://www.freecodecamp.org/news/javascript-projects-for-beginners/
3) Go to codewars easier challenges

Exercises:

Write a function that takes an array of numbers and returns the largest number in the array.

Write a function that takes an array of strings and returns a new array containing only the strings that are shorter than 4 characters.

Write a function that takes an array of numbers and returns a new array containing only the even numbers from the original array.

Write a function that takes an array of numbers and returns the sum of all the numbers in the array.

Write a function that takes an array of words and returns a new array containing only the words that are palindromes (words that are spelled the same forwards and backwards, like "racecar" or "level").

Try writing some code using loops, if statements etc to
- create a new array that is the reverse of the old array

- reverse an array by modifying it in place

- see what happens if you use the `delete` keyword on an array element

- see what happens if you index or `.find` an element that doesn't exist

- try out the built-in functions `map`, `filter`, `reduce`. See if you can get an intuition for what they do and how they're generally useful

My university programming course assignments.
Based on research, I think I should keep learning more of javascript for the time being.
 
@shivajikobardan, the exercises you list are a good start, other than they would be very simple for someone who has done any programming with functions that have array parameters. The freecodecamp exercises seem a little more involved, inasmuch as they are doing display kinds of operations.

Anyway, the more practice, the better you will get at coding. If you have problems with them, post the question and the work you have done in the Engineering & Comp. Sci Homework section, and I'm sure you'll get help.
 
  • Like
Likes shivajikobardan
thank you.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top