Skip to main content

Summary Semester 1

Assignment #1 

1. Compound Word
Jojo has just learned about compound words, which occurs when two or more words are joined to make one longer word. For example the English word footpath, composed of two words "foot" and "path". She wants you to make one such word, given two words that make up the compound word.

2. Birthday Cinema *
Jojo, Lili, and Bibi wants to treat their N friends. They want to treat their N friends to watch a movie. Each movie ticket cost 1 point. Luckily there is a promo, if you buy 2 tickets you get 1 for free.
How many points do they need to spend to buy tickets for all of them.

3. Counting Number
Lili has just learned how to count from 1 to n, while Jojo just recently learned how to use a calculator. When Lili counts from 1 to n, Jojo always adds the numbers that Lili mentions. Jojo asked for your help to check if he used the calculator correctly, he needs you to calculate the number he is supposed to get.

4. Booming Popularity
Lili is a celebrity on a social media called GI. She already has 1 million followers in 3 weeks. Bibi also want to have a lot of followers, then Bibi asked Lili. After Bibi got advice from Lili, her followers doubled everyday. Now Bibi wants to know how many follower Bibi will have after K days from now if she has N follower today.

5. Whitespaces *
Do you have a phone book? In each contact, there is at least a name and a phone number. In this problem, you will be asked to split a string into 3 sets of name and phone number.
link : https://www.w3schools.com/jsref/jsref_regexp_not_0-9.asp

Assignment #2

1. Repetition **
Jojo got a punishment from his teacher because he is naughty. He needs to write N times of "I will become a good boy.". It's very troublesome. To make it easier, he will create a program that can do his task. He will skip every composite line number to reduce the usage of paper (He needs to print in paper). Help him! [PRIME]
link : https://www.programiz.com/c-programming/examples/prime-number-intervals

2. Operator 
We know that operator is important. Because of that, we need to have a good understanding in it. Every operator will have precedence. To test your understanding about that, you will be given several operators and you need to output it from the operator with highest precedence until operator with the lowest precedence. 

3. Leap Year 
A leap year is a year that is divisible by 4 and not divisible by 100 with the exception that year are divisible by 400, which also a leap year. Your task is to compute the number of leap year from year 1 until year N.

4. 999 *
This is a simple problem, you just have to print the result of x divided by 999. [FLOOR].
link : https://www.tutorialspoint.com/c_standard_library/c_function_floor.htm

5. Challenge Sum **
 Given a number N, your task is to print N, reverse number of N, sum of N with the reverse of N, and reverse number from the sum of N with the reverse of N without the leading zero. Here are the example about without leading zero: If the number is 123, then print 123 If the number is 00123, then print 123

All Class Week 3 Extra
1. Okay Enough Perfect  
You are given a number N with a value of 1 and then you must do Q process to the number. Each process you should multiply the number by 2 and then add 1 to it. Given Q process what is the value of N after Q processes.

2. 
--------------------------------------------------------------------------------------------------------------------------

SEMESTER 2

Material

  • Function
  • Recursion **
  • Structure
  • File Processing ** 
  • Sorting **
  • Searching **
  • String trype **
Exercise
  • Membuat menu [File Processing] [Structure] [Sorting] [Searching]

Quiz #5 [Recursion]

1. Vowel Character *** 
Jojo has a string S and need you to tell how many vowel characters are there in the string. The list of vowel characters are “A”, “I”, “U”, “E”, “O” (both in its uppercase or lowercase form). Please note that “Y” is not considered as vowel character in this problem in any possible strings. [FUNCTION] [RECURSION]
/* 
int vowelCount(char *input) V 
void reversePrint(char *input) V 
int countVowel(char input[]) V
void countVowel(char input[]) V
*/

2. Power Number
Jojo is asked to calculate A to the power of X (A X ) by his mentor. Please help him to do that.
Note that, 3 to the power of 2 is 9 (3 2 = 9). and 2 to the power of 10 is 1024 (2 10 = 1024).
For this problem, please make a function “ int numberPower(int A, int X) ” that return the calculated value of A to the power of X (A X ). [RECURSION] [FUNTION]

3. Reverse Print 
Bibi has a string S and need to print the string S in its reverse form. For example, if Bibi has a string “Bibi loves to eat” then its reverse form is “tae ot sevol ibiB”. It’s time for you to help Bibi.
For this problem, please make a function “ void reversePrint(const char *str) ” that print the reverse form of the given string.
Note that for this problem, you HAVE TO use a recursive solution . Do not include “string.h” library or use any built-in C/C++ function. You need to make your own recursive function and you do not need “strlen” or any-other string.h related function in order to solve this problem.  [RECURSION] [FUNTION]
/* 
jangan lupa %
void reverse(char input[]) V
void reversePrint(char *input) V
*/

Quiz #6 [Recursion]

1. Fibo Counting
Jojo just learnt how to call fibonacci number by using recursive function from his teacher. Now Jojo want to know, given integer N and M, count how many times function f(M) will be called if Jojo execute fibonacci recursion from f(N). Note that f(1) = f(2) = 1.[RECURSION][FUNCTION]

2. How Old Are You ?
Jojo have data of all people in his class. Each time someone wonders how old is another someone, they will ask Jojo. Jojo became tired to answer these questions and he asked you to make a program to answer it [STRING] [SEARCHING][STRUCT].

3. Pangram ?
A pangram is a phrase that includes at least one occurrence of each of the 26 letters, from 'a' to 'z' (case insensitive). Given a string, you need to check whether it's a pangram or not.
link : https://www.codingconnect.net/c-program-check-given-string-pangram/

Assignment Bifest

1. Good
In this problem, you should check whether there is 'good' or not in a line. [FUNCTION] [STRING]

2.  Tiles
Do you know Piano Tiles? It's a simple game that only needs tapping using finger. In this problem, your task is to count what is the minimum tap you need so that you get all the tiles?
To simplify the problem, you will get N lines with M characters each. In each line, there is '|', '/' or '\' representing the tiles, otherwise it's '.'. If in the i-th column is a tile, then the last position of your finger after the tiles is :
if '|', then (i)-th column
if '/', then (i-1)-th column
if '\', then (i+1)-th column
In this problem, there are sliders. A series of tiles are called slider if the next tile is in the last position of your finger.
In slider, you only need to tap at the beginning of the slider [NESTED IF] [STRING INSIDE INDEX]

3. Jo Number
Jojo likes Jo numbers. A Jo numbers are positive integers whose decimal representation contains only 7 and 8. For example, 8 and 778 are Jo while 18 and 286 are not. Jojo calls a number semi-Jo if it could be evenly divided by some Jo number. Given integer N, help him find out if it's an semi-Jo number [BARBAR]

Assignment #6

1. Pattern
Jojo found an interesting pattern. When N is 3, the pattern will print the first letter, the second letter, the first letter, the third letter, the first letter, the second letter and lastly the first letter. 
Here's the example : 
1 : A 
2 : ABA 
3 : ABACABA 
4 : ABACABADABACABA 
Help Jojo by printing the pattern when N is known. [RECURSIVE]

2. Simple Encryption
In cryptography, encryption is the process of encoding a message. In this problem you have to encrypt the given message in English alphabet. You have to change a letter to n-th alphabet after itself. In this case, the next character after 'z' is character 'a'. Any character other than alphabet ('a' to 'z') will remain unchanged. [STRING.H] 

3. Chess **
Your task is to write a program that reads a chess board configuration and output every black piece
position that can be attacked by white piece. White pieces will be represented by uppercase letters whereas black pieces will be represented by lowercase letters []

Assignment #7

1. Riding Bicycle
As Jojo is a university student now, there are no more sport class. So, he decided to ride bicycle to the campus everyday. As riding bicycle is pretty slow, he afraid that he would be late to his class. Given Jojo's average velocity v (km/hour), distance from Jojo's home to his campus d (km), and the time when class start t (XX:YY), tell Jojo the latest time to go from his home so he would not late to his class. [CEIL]

2. Student Data 
Bibi has just learnt about struct. Her teacher asked her to make a program that can save the data of all the student in her class using struct. Unfortunately, she forgot how to use a struct, so she asked for your help. After that, her teacher will ask her to show the data of a student with X student's number. [STRUCT] [SEARCHING]

3. Summary **
Jojo has a file contains a lot of numbers. His teacher asked him to make a statistical summary of this file. Jojo is too lazy to do it, and ask you to help him [FILE PROCESSING] [DOUBLE]

Assignment #8

1. Clothes 
Jojo is on vacation and he wants to buy souvenirs for his friends. When he goes to a clothing shop, the shop owner offers him a 10 dollar discount for every pair of items with the same size and color. He interested with the offer and remembered what color and size his friends want. How much discount can he get? [STRUCT] [SEARCHING] [GETCHAR]
- perhatikan variabel

2. Column
Lili is given N numbers and tasked to sort and print it. To save paper, she decides to make the data into several lines. Help her print the data. [SORTING] 

3. Search The Index
Given N positive integers and an integer X. For each query, you have to find index L and R where a[L]+a[L+1]+...+a[R] = X. Note that we will use zero-based array (the index of the array starts from 0).  [SEARCHING]

Comments

Popular posts from this blog

Cloud Storage

Cloud Computing atau nama lainnya adalah Komputasi Awan adalah teknologi yang menjadikan internet sebagai tempat penyimpanan database, aplikasi dan masih banyak lagi. Layanan Cloud Computing 1. Software as a Service (SaaS) Layanan pemakaian teknologi mengenai pemakaian software yang telah disediakan contohnya : gmail, outlook mail 2. Platform as a Service (PaaS) Cloud Computing dapat menyewakan sistem operasi, database engine, framework aplikasi untuk menjalankan aplikasi yang kita buat. Contohnya : windows azure  3. Infrastructure as a Service (IaaS) Cloud Service dapat memberikan layanan infrastruktur IT. Contohnya CPU, penyimpanan data, memory dan lainnya dapat disewa.  Cloud Deployment Model Deployment model define the type of access to the cloud. Type of access : 1. Private cloud       - Single organization only       - Managed by the org or a 3rd party       - On ...

File Processing

File and Streams Streams, definition : To keep data from the keyboard saved at secondary storage such as a data file.  Streams is a sequence of character. File, When a C program run, there are 3 standard stream activated. 1. Standard Input Stream, controlling input stream from keyboard 2. Standard Output Stream, controlling output stream into the monitor 3. Standard Error Stream, controlling the error messaging All of these streams associated with a file. File Definition :  File is a collection of record Record is a collection of field Field is a block of byte Byte is a collection of bit File Operation, in C we perform 4 major operations on the file :  1. Creating a new file  Make a new text file to keep our data saved there 2. Opening an existing file When opening the file that has our data in it, we use,  The syntax for opening a file in standard I/O is: fptr = fopen("fileopen.txt","mode"); Mode is a feature that allow us...