pomos za nekolku zadaci
Izvinite, posto jas sum pocetnik vo programiranje, student na FEIT, ima nekoi "poteski" zadaci koi nemozam da gi resam. Dokolku nekoj ima vreme za toa ke go zamolam da mi pomogne.
Zadaca 1. Given is a matrix P of integers with M rows and N columns, each of the rows is sorted in ascending order.
Write a program that finds and reports all the numbers that occur in each row. The program should also report if there is no such number.
Example: for M=4, N=5 and following matrix P:
2 3 5 7 9
4 6 9 11 13
1 3 7 9 10
3 3 4 8 9
Correct answer is "9" because this number occurs in each of the rows.
Zadaca 2. If a sequence of X integer (signed and unsigned) numbers is given, write a program that extracts a subsequence (whose length is smaller or equal to X) of consecutive elements with the maximum possible sum.
Zadaca 3. For a given sequence of natural numbers greater then 2 consider the following operation: take the leading (i.e. the first) element of the sequence, jump over as many elements as the value of the element, and insert it to the obtained position.
Write a program which will determine, for a given element of the sequence, the number of steps necessary for the element to became the leading element the sequence.
Example:
1st step 3 4 5 6 7 8 9 10 ...
2nd step 4 5 6 3 7 8 9 10 ...
3rd step 5 6 3 7 4 8 9 10 ...
4th step 6 3 7 4 8 5 9 10 ...
Input: 6
Output: the element 6 becomes leading in the 4th step.
Zadaca 4. Implement a container class, which provides array functionality for various data types (assume, that the data type provides operator =). The class should provide at least methods to set and get the size of the array, to address (set and get) element and should free the allocated memory on exit (when the object is destroyed). There is no need to support re-sizing of the array, initialize the size at creation of the object is enough.
NOTE: Pre-definition of index operators [ ] and = operator is not obligatory.
Zadaca 5. Hamming Codes
Given N, B, and D: Find a set of N codewords (1 <= N <= 64), each of length B bits (1 <= B <= 8), such that each of the codewords is at least Hamming distance of D (1 <= D <= 7) away from each of the other codewords. The Hamming distance between a pair of codewords is the number of binary bits that differ in their binary notation. Consider the two codewords 0x554 and 0x234 and their differences (0x554 means the hexadecimal number with hex digits 5, 5, and 4):
0x554 = 0101 0101 0100
0x234 = 0010 0011 0100
Bit differences: xxx xx
Since five bits were different, the Hamming distance is 5.
Input file: INPUT.DAT
Format: N, B, D on a single line
Example input file:
16 7 3
Output to screen: N codewords, sorted, in decimal, ten per line.
Example (but not only possible example):
0 7 25 30 42 45 51 52 75 76
82 85 97 102 120 127
Veruvam deka za onie so pogolemo iskustvo nema da bide problem da mi pomognat barem za nekoja zadaca.
Moze vo C++ ili C#, a za onoj sto ke mi pomogne neka znae deka zasekogas ke mu bidam blagodaren :wink: