सभी किताबें

पेशेवर

1 Markets I: The Ecosystem and Exchange-Traded Marketsबाज़ार ऑनलाइन 2 Markets II: Rates, FX and Creditबाज़ार ऑनलाइन 3 Markets III: Commodities, Energy and Cryptoबाज़ार ऑनलाइन 4 Quantitative Methodsविधियाँ ऑनलाइन 5 Derivatives and Volatilityडेरिवेटिव्स ऑनलाइन 6 Rates, Credit, XVA and Riskब्याज दरें, क्रेडिट और जोखिम ऑनलाइन 7 Research Craft: Predictors, Backtests, Measurement, Portfoliosअनुसंधान ऑनलाइन 8 Strategies I: Equities and Futuresरणनीतियाँ ऑनलाइन 9 Strategies II: Volatility, Relative Value, Macro and the Bank Desksरणनीतियाँ ऑनलाइन 10 Microstructure and Executionनिष्पादन ऑनलाइन 11 Market Making and High-Frequency Tradingमार्केट मेकिंग ऑनलाइन 12 Machine Learning for Marketsमशीन लर्निंग ऑनलाइन 13 Low-Latency Softwareतकनीक ऑनलाइन 14 Networks, Hardware and Trading Infrastructureतकनीक ऑनलाइन 15 Research, Data and Risk Platformsतकनीक ऑनलाइन 16 The Desk and the Firmफ़र्म ऑनलाइन 17 The Industry: Firms, Roles and Careersकरियर ऑनलाइन 18 Interviews I: Maths, Probability and Speedकरियर ऑनलाइन 19 Interviews II: Markets, Trading Games and the Final Roundकरियर ऑनलाइन 20 Interviews III: Codeकरियर ऑनलाइन
ऐप्स परिचय Coach लॉग इन पढ़ना शुरू करें

Computer Science · शब्दावली

Loop क्या है?

Definition 10.2 Primary & Middle School Computer Science · अध्याय 10 — Algorithms: Repeat and Decide

A loop is a group of instructions that is carried out again and again: a given number of times (“repeat 4 times”), or until something happens (“repeat until the square ahead is a wall”).

The loop “repeat 4 times: forward, forward, turn left”. The robot starts on S, facing right, walks around a square and comes back to S, facing right again.
The loop “repeat 4 times: forward, forward, turn left”. The robot starts on S, facing right, walks around a square and comes back to S, facing right again.
“Repeat until the square ahead is a wall: forward”. The dark square is the wall.
“Repeat until the square ahead is a wall: forward”. The dark square is the wall.

उदाहरण

Example 10.3 (Forward until the wall)

The robot stands on S, facing a wall somewhere ahead. The algorithm is:

repeat until the square ahead is a wall:
forward

Before each step, the robot checks the square ahead. Here it moves three times, then sees the wall and stops. With the wall one square further, the same algorithm would move four times: it works wherever the wall is.

Example 10.5 (A robot that finds its way)

The robot starts on S, facing right, on a grid with two walls. The algorithm is:

repeat until the robot is on the star:
if the square ahead is free then forward
otherwise turn left

A square is free if it is not a wall and is still on the grid: the edge of the grid counts as a wall. It moves forward three times; then the square ahead is a wall, so it turns left. It moves forward twice; the next square ahead is a wall again, so it turns left. Two more steps forward, and it is on the star: the loop stops, after 7 steps forward and 2 turns.

अध्याय में पढ़ें →