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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top