Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
With c programming and without pointer and function
Harry and Larry are now bored playing with numbers. Now they want to play with plus and minus signs. This time they don’t want to give signs one by one. Anyone can give any number of signs at a time but at most N signs. Can you tell the maximum of all signs that they gave sequentially?
For example:
- If the input is 7 + + - + - - - , then the answer is 3 as 3 minus signs are given sequentially and it is the maximum.
- If the input is 7 + + + + + - - , then the answer is 5.
Input Format
- First line will contain a positive integer N
- Second line will contain N signs (+ or -)
Constraints
- 0 < N <= 100
Output Format
- Output a single integer, the maximum of all signs that came sequentially.
Sample Input 0
7++++---
Sample Output 0
4
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Lets say we are creating a python game. A word is displayed gets displayed on the screen. The players of the game must type as many words as they an that are related to the word that is displayed. If players type in the same word multiple times, it is ignored. One the players are done taking turns, the program gives each player a score that is based off how many wrods they entered that are similiar to what other words players have entered. So for a player to get a point, the word they typed must be typed by another student. QUESTION: We need to store the words typed by the players and all words etered. Would we use a list, set, dict or tuple?arrow_forwardusing C++ don't use other than this. and follow the conditions written in the paper please if you can't leave it to who know . this is the third time i upload it please read carefullyarrow_forwardIn MATLAB, primes(N) provides all the prime numbers less than or equal to N. E.g. primes(15) = [2 3 5 7 11 13]. The sum of the first digit of each prime is 19 (i.e. 2+3+5+7+1+1 = 19). What is the sum of the first digit of all primes less than or equal to 55555? You may want to use the num2str() function. Please use matlabarrow_forward
- Provide Python code for the given Lab problem.arrow_forwardComputer Science You must count the number of strings of length 6 over the alphabet A = {x, y, z}. Any string of length 6 can be considered as a 6-tuple. For example, the string xyzy can be represented by the tuple (x,y,z,y). So the number of strings of length 6 over A equals the number of 6-tuples over A, which by product rule is N. Find N. (Use the following product rule for any finite set A and any natural number n : |A^n|=|A|^n)arrow_forwardWrite a program that gets one integer number as input and outputs a palindrome as bellow.While writing this program, you should be using a recursive function. validate your input to be integer and positive.Sample input: 5Sample output: 5 0 4 0 3 0 2 0 1 0 1 0 2 0 3 0 4 0 5Sample input: 4Sample output: 4 0 3 0 2 0 1 0 1 0 2 0 3 0 4arrow_forward
- Write the robot program using the VAL+ for the following automation case. First draw the problem; then handwrite the VAL+ code. The robot picks up FIVE blocks of size 100x100x100 mm that are stacked at a fixed position and place them at the corners and center of a square table of size 500 x 500 mm. Select the original position on the table on your own.arrow_forwardUsing C++ only A serious accident occurred on the National Highway, so an ambulance arrived immediately and the patient had to be rushed to the hospital as soon as possible. There are N Cities numbered 1,2,3.... N in the vicinity and the patient has M minutes to go before he dies, and there is one hospital in Y-Y and now in X, therefore he must reach the hospital very quickly. You should find out if the patient can be saved in M minutes or not. Input 107257 3 10 8 129 Output diedarrow_forwardImagine you have 331 sheep, and you are going to use primitive counting to write a tally stick for the King. Suppose you carry out the procedure as usual, filling the pens with sheep, and liberating the sheep from pen 2 (and any extra sheep); then doing it again, doing it again, etc., until you get down to one sheep.How many sheep will you have in the first pen After one round? After two rounds? After three rounds?arrow_forward
- Write a recursive function in Java that accepts an integer as input and returns 1 + 1/2 + 3 + 1/4 + ...(n or 1/n). The answer is the sum of the odd integers from 1 to n plus the sum of the reciprocals of the even integers.arrow_forwardWrite a program in C-language that will accept any positive number and will count up, starting from 1 up to the given number Sample output: Input a number: 5 The output is: 1 2 3 4 5arrow_forwardPlease do it in c++ as soon as possible. From the get go, Mr. Chanek has a grid an of size n×m Each phone (x,y) contains a number ax,y demonstrating the course of how the ball will move. ax,y=1 — the ball will move aside (the accompanying cell is (x,y+1)); ax,y=2 — the ball will move to the base (the accompanying cell is (x+1,y)); ax,y=3 — the ball will move aside (the accompanying cell is (x,y−1)). Each time a ball leaves a cell (x,y), the number ax,y will change to 2. Mr. Chanek will drop k balls progressively, each start from the primary line, and on the c1,c2,… ,ck-th (1≤ci≤m) segments. Choose in what segment each ball will end up in (position of the ball in the wake of leaving the grid). Input The chief line contains three whole numbers n, m, and k (1≤n,m≤1000, 1≤k≤105) — the size of the cross section and the amount of balls dropped by Mr. Chanek. The I-th of the accompanying n lines contains m numbers ai,1,ai,2,… ,ai,m (1≤ai,j≤3). It will satisfy ai,1≠3 and ai,m≠1. The…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education