text:
# Publications

## Publications

Harvard's Solar Geoengineering Research Program seeks to advance natural and social science research on solar geoengineering. The following academic and non-technical publications highlight some of the latest findings.

Horton, Joshua B.Parametric Insurance as an Alternative to Liability for Compensating Climate Harms.” Carbon & Climate Law Review 12, no. 4 (2018): 285-296. Publisher's VersionAbstract
Interstate compensation for climate change based on legal liability faces serious obstacles. Structural incongruities related to causation, time, scope, and scale impede application of tort law to climate change, while political opposition from developed countries prevents intergovernmental consideration of liability as a means of compensating for climate damages. Insurance, however, in particular parametric insurance triggered by objective environmental indices, is emerging as a promising alternative to liability. This is manifest in the UNFCCC and the Paris Agreement, which ruled out recourse to legal liability, and in the formation and expansion of regional sovereign climate risk insurance schemes in the Caribbean, Africa, and the Pacific. Theory and early practice suggest that parametric insurance exhibits five key advantages compared to legal liability in the climate change context: (1) it does not require that causation be demonstrated; (2) it has evolved to provide catastrophic coverage; (3) it is oriented toward the future rather than the past; (4) it is contractual, rather than adversarial, in nature; and (5) it provides a high degree of predictability. Compensation based on parametric insurance represents a novel climate policy option with significant potential to advance climate politics.
Smith, Wake, and Gernot Wagner. “Stratospheric aerosol injection tactics and costs in the first 15 years of deployment.” Environmental Research Letters 13 (2018). Publisher's VersionAbstract
We review the capabilities and costs of various lofting methods intended to deliver sulfates into the lower stratosphere. We lay out a future solar geoengineering deployment scenario of halving the increase in anthropogenic radiative forcing beginning 15 years hence, by deploying material to altitudes as high as ~20 km. After surveying an exhaustive list of potential deployment techniques, we settle upon an aircraft-based delivery system. Unlike the one prior comprehensive study on the topic (McClellan et al 2012 Environ. Res. Lett. 7 034019), we conclude that no existing aircraft design—even with extensive modifications—can reasonably fulfill this mission. However, we also conclude that developing a new, purpose-built high-altitude tanker with substantial payload capabilities would neither be technologically difficult nor prohibitively expensive. We calculate early-year costs of ~$1500 ton−1 of material deployed, resulting in average costs of ~$2.25 billion yr−1 over the first 15 years of deployment. We further calculate the number of flights at ~4000 in year one, linearly increasing by ~4000 yr−1. We conclude by arguing that, while cheap, such an aircraft-based program would unlikely be a secret, given the need for thousands of flights annually by airliner-sized aircraft operating from an international array of bases.
Irvine, Peter J., David W. Keith, and John Moore. “Brief communication: Understanding solar geoengineering's potential to limit sea level rise requires attention from cryosphere experts.” The Cryosphere 12 (2018): 2501-2513. Publisher's VersionAbstract
Stratospheric aerosol geoengineering, a form of solar geoengineering, is a proposal to add a reflective layer of aerosol to the stratosphere to reduce net radiative forcing and so to reduce the risks of climate change. The efficacy of solar geoengineering at reducing changes to the cryosphere is uncertain; solar geoengineering could reduce temperatures and so slow melt, but its ability to reverse ice sheet collapse once initiated may be limited. Here we review the literature on solar geoengineering and the cryosphere and identify the key uncertainties that research could address. Solar geoengineering may be more effective at reducing surface melt than a reduction in greenhouse forcing that produces the same global-average temperature response. Studies of natural analogues and model simulations support this conclusion. However, changes below the surfaces of the ocean and ice sheets may strongly limit the potential of solar geoengineering to reduce the retreat of marine glaciers. High-quality process model studies may illuminate these issues. Solar geoengineering is a contentious emerging issue in climate policy and it is critical that the potential, limits, and risks of these proposals are made clear for policy makers.
Horton, Joshua B., Jesse L. Reynolds, Holly Jean Buck, Daniel Callies, Stefan Schäfer, David W. Keith, and Steve Rayner. “Solar Geoengineering and Democracy.” Global Environmental Politics (2018): 5-24. Publisher's VersionAbstract
Some scientists suggest that it might be possible to reflect a portion of incoming sunlight back into space to reduce climate change and its impacts. Others argue that such solar radiation management (SRM) geoengineering is inherently incompatible with democracy. In this article, we reject this incompatibility argument. First, we counterargue that technologies such as SRM lack innate political characteristics and predetermined social effects, and that democracy need not be deliberative to serve as a standard for governance. We then rebut each of the argument’s core claims, countering that (1) democratic institutions are sufficiently resilient to manage SRM, (2) opting out of governance decisions is not a fundamental democratic right, (3) SRM may not require an undue degree of technocracy, and (4) its implementation may not concentrate power and promote authoritarianism. Although we reject the incompatibility argument, we do not argue that SRM is necessarily, or even likely to be, democratic in practice.
More

More


text:
On the problem $$Ax= \lambda Bx$$ in max algebra: Every system of intervals is a spectrum.(English)Zbl 1248.15023

In max algebras, a very important problem is the eigenproblem. There exist efficient algorithms for computing both eigenvalues and eigenvectors. The present paper deals with the two-sided generalized eigenproblem over a max algebra which does not seem to be well-known unlike the eigenproblem. The spectrum may include intervals and it is proved that any finite system of real intervals can be represented as spectrum of this eigenproblem.

MSC:

 15A80 Max-plus and related algebras 15A18 Eigenvalues, singular values, and eigenvectors 15A22 Matrix pencils
Full Text:

References:

 [1] Akian, M., Bapat, R., Gaubert, S.: Max-plus algebras. Handbook of Linear Algebra (L. Hogben, Discrete Math. Appl. 39, Chapter 25, Chapman and Hall 2006. [2] Baccelli, F. L., Cohen, G., Olsder, G.-J., Quadrat, J.-P.: Synchronization and Linearity: An Algebra for Discrete Event Systems. Wiley 1992. · Zbl 0824.93003 [3] Binding, P. A., Volkmer, H.: A generalized eigenvalue problem in the max algebra. Linear Algebra Appl. 422 (2007), 360-371. · Zbl 1121.15011 [4] Brunovsky, P.: A classification of linear controllable systems. Kybernetika 6 (1970), 173-188. · Zbl 0199.48202 [5] Burns, S. M.: Performance Analysis and Optimization of Asynchronous Circuits. PhD Thesis, California Institute of Technology 1991. [6] Butkovič, P.: Max-algebra: the linear algebra of combinatorics? Linear Algebra Appl. 367 (2003), 313-335. · Zbl 1022.15017 [7] Butkovič, P.: Max-linear Systems: Theory and Algorithms. Springer 2010. · Zbl 1202.15032 [8] Cochet-Terrasson, J., Cohen, G., Gaubert, S., Gettrick, M. M., Quadrat, J. P.: Numerical computation of spectral elements in max-plus algebra. Proc. IFAC Conference on Systems Structure and Control, IRCT, Nantes 1998, pp. 699-706. [9] Cuninghame-Green, R. A.: Minimax Algebra. Lecture Notes in Econom. and Math. Systems 166, Springer, Berlin 1979. · Zbl 0399.90052 [10] Cuninghame-Green, R. A., Butkovič, P.: The equation $$A\otimes x=B\otimes y$$ over (max,+). Theoret. Comput. Sci. 293 (2003), 3-12. · Zbl 1021.65022 [11] Cuninghame-Green, R. A., Butkovič, P.: Generalised eigenproblem in max algebra. Proc. 9th International Workshop WODES 2008, pp. 236-241. [12] Elsner, L., Driessche, P. van den: Modifying the power method in max algebra. Linear Algebra Appl. 332-334 (2001), 3-13. · Zbl 0982.65042 [13] Gantmacher, F. R.: The Theory of Matrices. Chelsea, 1959. · Zbl 0085.01001 [14] Gaubert, S., Sergeev, S.: The level set method for the two-sided eigenproblem. E-print · Zbl 1279.15024 [15] Heidergott, B., Olsder, G.-J., Woude, J. van der: Max-plus at Work. Princeton Univ. Press, 2005. [16] McDonald, J. J., Olesky, D. D., Schneider, H., Tsatsomeros, M. J., Driessche, P. van den: Z-pencils. Electron. J. Linear Algebra 4 (1998), 32-38. · Zbl 0907.15010 [17] Mehrmann, V., Nabben, R., Virnik, E.: Generalization of Perron-Frobenius theory to matrix pencils. Linear Algebra Appl. 428 (2008), 20-38. · Zbl 1130.15007
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.

format: plain


text:
.
Категории сайта
1/ Взять подсказку
:

# Тренировочный CES тест онлайн для моряков по Sulzer Medium Speed Diesel Engine

Добро пожаловать на страницу, где вы можете пройти тест CES онлайн по теме дизели Зульцер. Данная практика поможет вам, как морскому специалисту, подготовиться к сдаче экзаменов, получению сертификата компетентности или аттестата.

Выберите режим, в котором хотите пройти CES тест:

Начать тест
Select the correct option to accurately complete the following statement according to the information provided in this module. During slow turning of the main engine, the indicator cocks:
Must be fully open throughout the operation.
Must be kept shut throughout the operation.
Need only be partially opened.
May be either open or closed.
Принять ответ
Select the correct option to accurately complete the following statement according to the information provided in this module. The main engine can be started after a long period of shutdown:
Almost immediately.
Only after performing basic checks listed in this module.
Only after performing advanced checks and critical measurements.
Only with the permission of the head office ashore.
Принять ответ
Select the correct option to accurately complete the following statement according to the information provided in this module. The turning of the cylinder lubricators before start-up:
Is to ensure pre-lubrication and assess the force required to pump the cylinder lubricating oil and check its flow.
Is merely a part of routine.
Makes no difference at all.
Wastes unnecessary lubricating oil and must be avoided.
Принять ответ
Select the correct option to accurately complete the following statement according to the information provided in this module. When paralleling two main engines, the rpm of the incoming engine should be:
Slightly lower than the running engine.
Slightly higher than the running engine.
The same rpm as the running engine.
Fluctuating between higher and lower rpm than the running engine.
Принять ответ
Select the correct option to accurately complete the following statement according to the information provided in this module. When two of the Sulzer 12ZAV40S engines are running in parallel:
Each speed governor controls the fuel setting for its own engine.
One of the speed governors controls the fuel setting for both engines, ordering the same fuel setting for each engines.
One of the speed governors controls the fuel setting for both engines, ordering an increased fuel setting for the first connected engine.
One of the speed governors controls the fuel setting for both engines, ordering an increased fuel setting for the second connected engine.
Принять ответ
Select the correct option to accurately complete the following statement according to the information provided in this module. The options for starting the auxiliary engines are:
From wheelhouse and control room.
From the SELMA computer and a manual start facility.
From the engine room only.
From any remote location such as the cargo control room.
Принять ответ
Select from the statements given in the options the one, which is most accurate according to the information provided in this module:
Some of the main engine auxiliary pumps and machines are normally running continuously.
All of the main engine auxiliary pumps and machines are started using a group start system.
All of the main engine auxiliary pumps and machines are started and stopped using Pressostat control.
All of the main engine auxiliary pumps and machinery normally run continuously.
Принять ответ
Which one of the given options is the highest voltage available on board the vessel studied in this module?
440 V.
220 V.
110 V.
660 V.
Принять ответ
Which of the given options is the power rating for each of the main engines featured in this module?
4 000 KW.
7 100 KW.
5 000 KW.
6 000 KW.
Принять ответ
Which of the manufacturers given in the options made the separators used in the ship studied in this module?
Alfa Laval.
Westfalia.
Mitsubishi.
De Laval.
Закончить тест
* В некоторых вопросах теста может быть несколько правильных ответов.
“CES тест” пройден! Ваш результат:
Нашли ошибку? Выделите и нажмите CTRL+Enter
Апрель, 09, 2022 1412 0
Избранные статьи
• Список избранных статей пуст.

Здесь будут храниться статьи, сохраненные вами в "Избранном". Статьи сохраняются в cookie, поэтому не удаляйте их.

Статья добавлена в избранное! Перезагрузка...
Вставить формулу как
Дополнительные настройки
Цвет формулы
Используйте LaTeX для набора формулы
Предпросмотр
$${}$$
Формула не набрана
Вставить


text:
# Morgenstern proof for FFT lower bound

I looked at my notes from a class about fast forier transform , and the professor proved in class theorem thanks to Morgenstern , first he defined linear algorithm as a algorithm that inly uses multiplications by scalar and addtions, that he stated Morgenstern's theorem the following way

Every linear algorithm that computes DFT (Discrete Fourier Transform) , in which the scalar are bounded in their absolute value by $C$ , takes at least $\Omega_C(n\log{n})$ addition operations.

I haven't understood his proof , if someone can give me guidlines to the proof I'll be more than happy :) [right now my proof of the theorem looks like a mess]

p.s.: In class he said we will write in each step the coeffiecents of the linear function that was just computed , then he defined a "computation advancment function" , I didn't understand his definition of this function , it was definied something like $\phi(k)=$ maximum determinant of n$\times$n matrices that were computed untill the k'th step [I probably copied wrong]

• The problem lies in the following two facts: I literally couldn't understand what I wrote in my notebook(The proffesor went really fast) I nned the proof from class because I am scribing a class including this theorem.(it was the last class so no one except me wrote at that time) I am not asking for proof but I haven't undertood the start of the proof , maybe after understanding what he meant when he defined the computation advancment function it would be clearer how to prove this theorem – UserB95 Feb 19 '15 at 0:00
• I ask for guidelines not proof because few lines confused me , and I don't have the intution for why the theorem is correct. – UserB95 Feb 19 '15 at 0:00
• A source where the proof is readible will be also super :) [I haven't found one] – UserB95 Feb 19 '15 at 0:06

Morgenstern first defines the notion of a linear algorithm. A linear algorithm gets as input $x_1,\ldots,x_n$ and its goal is to compute some $y_1,\ldots,y_m$, each of which is a (specific) linear combination of $x_i$s. The algorithm proceeds in steps, starting with step $n+1$. At step $t$, the algorithm computes $x_t = \lambda_t x_i + \mu_t x_j$ for some $i,j < t$. At the end of the computation, for each $i$, $y_i = x_j$ for some $j$.

For example, here is an algorithm computing the unnormalized DFT on 2 variables: $$x_3 \gets x_1 + x_2 \\ x_4 \gets x_1 - x_2$$ Similarly, the unnormalized two dimensional DFT on $2^2$ variables is computed by: $$x_5 \gets x_1 + x_2 \\ x_6 \gets x_1 - x_2 \\ x_7 \gets x_3 + x_4 \\ x_8 \gets x_3 - x_4 \\ x_9 \gets x_5 + x_7 \\ x_{10} \gets x_5 - x_7 \\ x_{11} \gets x_6 + x_8 \\ x_{12} \gets x_6 - x_8$$

We can view each $x_t$ as an $n$-dimensional vector which gives the linear combination of $x_1,\ldots,x_n$ producing $x_t$; call this vector $v_t$. The vectors $v_1,\ldots,v_n$ are just the $n$ basis vectors.

Morgenstern defines the quantity $\Delta_t$, which is the maximum magnitude of the determinant of any square submatrix of the matrix $V_t$ whose rows are $v_1,\ldots,v_t$.

Lemma. Let $c \geq 1/2$. If $|\lambda_s|,|\mu_s| \leq c$ for all $s$ then $\Delta_{n+t} \leq (2c)^t$.

Proof. The proof is by induction on $t$. When $t = 0$, this is easy to verify directly since $V_n$ is just the identity matrix. Consider now any $t > 0$. Every square submatrix of $V_t$ is either a square submatrix of $V_{t-1}$, in which case its determinant is at most $(2c)^{t-1} \leq (2c)^t$ by induction, or it involves the new row $v_t = \lambda_t v_i + \mu_t v_j$. In the latter case, we can write the square submatrix $A$ as $A = \lambda_t B + \mu_t C$, where $B,C$ are square submatrices of $V_{t-1}$ (replace the relevant part of $v_t$ by the corresponding parts of $v_i$ and $v_j$). Since the determinant is a linear function of any of its rows, $\det(A) = \lambda_t \det(B) + \mu_t(C)$. By induction, $|\det(B)|,|\det(C)| \leq (2c)^{t-1}$, and so $$|\det(A)| \leq |\lambda_t| |\det(B)| + |\mu_t| |\det(C)| \leq c(2c)^{t-1} + c(2c)^{t-1} = (2c)^t.$$

Corollary. Computing the DFT on $n$ variables using a linear algorithm with bounded coefficients requires $\Omega(n\log n)$ steps.

Proof. The determinant of the DFT matrix is $n^{n/2}$. Hence any linear algorithm computing the DFT in $t$ steps satisfies $\Delta_t \geq n^{n/2}$. If the bound on the coefficients is $c$, then the lemma shows that $(2c)^t \geq n^{n/2}$ and so $t = \Omega(n\log n)$.

Remark. Strassen has shown that any algebraic algorithm (algorithm involving $+,-,\cdot,/$) for computing the DFT can be transformed to a linear algorithm using the same number of steps.

Morganstern's original paper is here:

Jacques Morgenstern. Note on a lower bound on the linear complexity of the fast Fourier transform. J. ACM, 20(2):305–306, April 1973.

• I do't have access to this – UserB95 Feb 19 '15 at 7:29


text:
# convert data points into equation

#### 7777ft

##### New member
Line segment A starts at (0, 80) and ends at (28000, 80). The equation is $$\displaystyle y=80$$.
Line segment B starts at (28000, 80). It has a rise of -2, and a run of 1000; hence a slope of -1/500. This equation is $$\displaystyle y=\frac{-x}{500}+136$$. This segment ends when y becomes negative.

The two lines resemble a hockey stick. Can these two equations be concatenated into one neat and tidy equation, and how would it be done?

#### tkhunny

##### Moderator
Staff member
1) Not usually.
2) Depends on what you mean by "neat and tidy".
3) There are any number of averaging or weighting methods.
4) What do you have against the piecewise definition you have already stated?

#### LCKurtz

##### Junior Member
And why such large numbers to get that shape? And your second segment doesn't "end when y becomes negative".

#### topsquark

##### Full Member
Line segment A starts at (0, 80) and ends at (28000, 80). The equation is $$\displaystyle y=80$$.
Line segment B starts at (28000, 80). It has a rise of -2, and a run of 1000; hence a slope of -1/500. This equation is $$\displaystyle y=\frac{-x}{500}+136$$. This segment ends when y becomes negative.

The two lines resemble a hockey stick. Can these two equations be concatenated into one neat and tidy equation, and how would it be done?
As tkhunny says "not usually." However there are curve fitting techniques that might be useful, though often messy. The general approach that I've seen takes your two lines and links them together by fitting a conic section (usually a parabola) between the two lines. The problems come in:
1) You have to pick two arbitrary points on each line to fit your parabola
2) The parabola's major axis is at an angle to the +x axis making the equation for the parabola icky.
3) The parabola has to be tangent to the lines at the points you have chosen.
4) If you don't like the results after graphing you have to start all over again.
5) This method does not always work well.
6) This method is ridiculously time consuming.
7) When you are done you still don't have a single equation, just three equations you put together piece-wise.

Failing the parabola, circles and ellipses also work.

-Dan

#### 7777ft

##### New member
4) What do you have against the piecewise definition you have already stated?
For the problem I'm trying to solve, I was hoping there would be an easy way to concatenate the segments into a single equation for calculating its derivative. Since that's not possible, my approach is wrong.

#### 7777ft

##### New member
And why such large numbers to get that shape? And your second segment doesn't "end when y becomes negative".
The large numbers are from a problem. You get what you get.
Lines continue on forever. Line segments have a definite beginning and ending. The second segment can't have negative y-values because negative quantities of objects are not possible.

#### 7777ft

##### New member
As tkhunny says "not usually." However there are curve fitting techniques that might be useful, though often messy. The general approach that I've seen takes your two lines and links them together by fitting a conic section (usually a parabola) between the two lines. The problems come in:
1) You have to pick two arbitrary points on each line to fit your parabola
2) The parabola's major axis is at an angle to the +x axis making the equation for the parabola icky.
3) The parabola has to be tangent to the lines at the points you have chosen.
4) If you don't like the results after graphing you have to start all over again.
5) This method does not always work well.
6) This method is ridiculously time consuming.
7) When you are done you still don't have a single equation, just three equations you put together piece-wise.

Failing the parabola, circles and ellipses also work.

-Dan
Over kill for the trivial-ish problem I'm attempting. Thanks for the suggestion. I'm sure it'll be useful at some point in the future.

#### Dr.Peterson

##### Elite Member
For the problem I'm trying to solve, I was hoping there would be an easy way to concatenate the segments into a single equation for calculating its derivative. Since that's not possible, my approach is wrong.
Making a single equation would actually make it harder to find the derivative. The equation would most naturally involve absolute values. The derivative will inherently be discontinuous, and in fact will be 0 for x less than 28000 and -1/500 after that -- that is, your description already contained the derivative, whereas a single equation would hide it.

#### LCKurtz

##### Junior Member
LCKurtz said:
And your second segment doesn't "end when y becomes negative"
The large numbers are from a problem. You get what you get.
Lines continue on forever. Line segments have a definite beginning and ending. The second segment can't have negative y-values because negative quantities of objects are not possible.
You said the second part of the formula had a rise of -2 and a run of 1000. I was just trying to point out to you that the second segment ends well before y becomes negative.
Another suggestion: Why not explain to us what problem you are actually trying to solve.

#### 7777ft

##### New member
Why not explain to us what problem you are actually trying to solve.
I've solved the problem, and the solution is actually easy. Initially I over thought the problem, which led me to geometry. The solution has nothing to do with geometry.

The problem is here, if anyone is feeling adventurous. Resist the urge to peek at the solution.

#### Dr.Peterson

##### Elite Member
That problem has nothing to do with the question you asked; it is also rather poorly written.

This shows one of the reasons we ask you to show the entire problem you are working on, not just the piece you think you need help with. Quite often people are on the wrong track, and asking only about that wastes everyone's time.


text:
# Alberta Why Is The Sky Blue Job Application

## Produce Jobs Agriculture Jobs BlueSkySearch.com

### Why the sky is blue. For reals Great Moments In

Sky Zone Trampoline Park Why Sky Zone. Show yourself or others how to use the EpiPen (epinephrine) Auto-Injector in the event of a severe allergic reaction. Learn more at EpiPen.ca. Blue to the sky., If a job application asked you "Why is the sky blue?" what would be your initial response, funny or otherwise? If a job application asked you "Why is the sky blue?".

### Why Is the Sky Blue? Wonderopolis

Why is the sky blue? Science Questions with Surprising. Blue Sky. The blue color of the sky is caused by the scattering of sunlight off the molecules of the atmosphere. This scattering, called Rayleigh scattering, is more, why is the sky blue. Uploaded 02/15/2008 why is the sky blue comment and tell NEXT JOKE Q Why did the blonde quit his job as a restroom attendant? 13 Comments..

Why can't you hear a pterodactyl urinate? Why is the sky blue? submitted 4 years ago by callousCnidarian. And how can we cheer it up? 1 comment; When asked why the sky is blue, Owlcation В» STEM В» Physics; Why Is the Sky Blue? Hint: It's Probably Not for the Reason You Think. Updated on January 6,

Why is the sky blue is a question discussed including funny answers to scientific inquiry and silly explanations to different hypotheses. Find out more about our wide range of Sky careers вЂ“ whether in front of the camera or behind the scenes, we've got the perfect job for you.

Blue Sky Resumes is a small team of professional writers and job search experts. We offer one-of-a-kind resumes, smart career advice and fantastic customer service. Diffuse sky radiation is solar radiation The explanation of the blue color by Rayleigh in 1871 is one of the most famous examples of the application of

Diffuse sky radiation is solar radiation The explanation of the blue color by Rayleigh in 1871 is one of the most famous examples of the application of Why is the sky blue? The sky appears blue on a clear sunny day. In the evening, the sky slowly turns yellow, red and orange. This happens even in the early

2012-04-20В В· Why is the sky blue? How should I answer these to job interview questions? Why is the sky blue? If you were a superhero what would your name be? 2018-10-03В В· Blue light is scattered in all directions by the tiny molecules of air in Earth's atmosphere. Blue is scattered more than other colors because it travels as shorter, smaller waves. This is why we see a blue sky most of the time. Closer to the horizon, the sky fades to a lighter blue or white.

Why can't you hear a pterodactyl urinate? Why is the sky blue? submitted 4 years ago by callousCnidarian. And how can we cheer it up? 1 comment; Why the Sky is blue (Scattering of Light) Relate the blue sky to the preferential scattering of light in its atmosphere. The daytime sky on Earth appears blue in colour.

Interview question for Cashier.Why is the sky blue?. The Meanings of Blue: Blue is the favorite color of all people. ItвЂ™s natureвЂ™s color for water and sky, but is rarely found in fruits and vegetables.

Current graduate and undergraduate students in engineering, science, technology, accounting, and business are invited to apply for this 12 to 15-week program. Most Blue Origin internships are available at our facility in Kent, Washington, but we also have opportunities at our facilities in West Texas and Cape Canaveral, Florida. Working with Blue sky. There are lots of jobs out there. There are only a few life-changing experiences and being part of the Blue sky team can give you the

Start studying why is the sky blue. Learn vocabulary, terms, and more with flashcards, games, and other study tools. Explore the reasons why Sky Zone is the premier indoor trampoline park.

why is the sky blue. Uploaded 02/15/2008 why is the sky blue comment and tell NEXT JOKE Q Why did the blonde quit his job as a restroom attendant? 13 Comments. If a job application asked you "Why is the sky blue?" what would be your initial response, funny or otherwise? If a job application asked you "Why is the sky blue?"

St. JohnвЂ™s Office. T: 709.733.CARE (2273) F: 709.757.3551 E: info@blueskyfamilycare.com . Suite 111, 38 Ropewalk Lane St. JohnвЂ™s, NL A1E 5T2 Blue Sky Resumes is a small team of professional writers and job search experts. We offer one-of-a-kind resumes, smart career advice and fantastic customer service.

What I'm wondering is, given that the spectrum of Rayleigh scattering goes like $\omega^4$, why is the sky not purple, rather than blue? How to save my job? BlueSkySearch.com is the Online Job Center for the Produce Industry, Agriculture and the Food Industry - Produce Jobs, Produce Industry Jobs, Agriculture Jobs, Food

SCIENCE вЂ” Earth and Space. Have You Ever Wondered... Why is the sky blue? What color is sunlight? Why does the sky turn red and orange at dawn and dusk? Show yourself or others how to use the EpiPen (epinephrine) Auto-Injector in the event of a severe allergic reaction. Learn more at EpiPen.ca. Blue to the sky.

16 Which Wich Cashier interview questions and 10 interview reviews. Application. I applied online. I I think one was "Why is the sky blue?" EMPLOYMENT APPLICATION PERSONAL INFORMATION depending on the job position. Such a report, or a credit report (if applicable), will

Why is the Sky Blue So, what is the rarest eye color in humans? Unfortunately, there is no eye color that has been fully agreed upon as the rarest, WeвЂ™ve created the new My Sky app with you in mind to make managing your Sky account and getting help and support quick and easy.View and вЂ¦

Why is the sky blue? The sky appears blue on a clear sunny day. In the evening, the sky slowly turns yellow, red and orange. This happens even in the early Meaning of the color blue is open spaces, freedom, intuition, Blue represents both the sky and the sea, and is associated with open spaces, freedom,

Wikipedia:You do need to cite that the sky is blue A statement that "the sky is blue" may be questioned because the sky frequently has a different colour 2018-10-03В В· Blue light is scattered in all directions by the tiny molecules of air in Earth's atmosphere. Blue is scattered more than other colors because it travels as shorter, smaller waves. This is why we see a blue sky most of the time. Closer to the horizon, the sky fades to a lighter blue or white.

Diffuse sky radiation is solar radiation The explanation of the blue color by Rayleigh in 1871 is one of the most famous examples of the application of What is the definition of science? Find out how to define science and learn about the different fields of science.

SEARCH JOBS Search for all JetBlue opportunities Search for first Blue Tales Blog; If you require a reasonable accommodation for our application Application. I applied in-person Some recently asked SYKES interview questions were, "was is project blue sky" and "Why would you like to work with us?

Why is the sky blue and not red? Update Cancel. Answer Wiki. 8 Answers. Vaughan Pratt, Physics major, taught CS @ MIT & Stanford, Why is the sky blue? Why is it IT support job description . supporting the rest of the business with their ongoing IT requirements, the sky is the limit. Sales support job description;

### HOW To Use The EpiPen Auto-Injector EpiPen.ca

Why is the sky blue? Quora. Why is the sky blue is a question discussed including funny answers to scientific inquiry and silly explanations to different hypotheses., Example Sky interview questions and how to for answering the qualifying questions on SkyвЂ™s application to the job description and identify areas.

### How should I answer these to job interview questions

Employee Application Form FormAssembly.com. Interview question for Cashier.Why is the sky blue?. https://en.wikipedia.org/wiki/Blue Employee Application Form. Blue Sky only works with ex-offenders and is required to collect information relating to applicants' offending Job title and duties.

Sample Job Interview Questions for Accounting and Finance Jobs. Free guide plus tips and techniques. How to Answer any Job Interview Question Working with Blue sky. There are lots of jobs out there. There are only a few life-changing experiences and being part of the Blue sky team can give you the

WHY THE SKY IS BLUE? you can never hope to be a man of science. You can perhaps get a job in some of the departments, get a nice comfortable salary, Sky blue is the name of a colour that resembles the colour of the sky at noon. The entry for "sky-blue" in Murray's New English Dictionary (1919) reports a first

Stupid Jokes Why The Sky Is Blue. We also have Stupid Jokes Why The Sky Is Blue quotes and sayings related to Stupid Jokes Why The Sky Is Blue. WeвЂ™ve created the new My Sky app with you in mind to make managing your Sky account and getting help and support quick and easy.View and вЂ¦

why is the sky blue. Uploaded 02/15/2008 why is the sky blue comment and tell NEXT JOKE Q Why did the blonde quit his job as a restroom attendant? 13 Comments. Employment Careers and Jobs. Each day at Blue Mountain holds an exciting new challenge and an opportunity to bring out your best. Learn Why Blue. Whether you're

IT support job description . supporting the rest of the business with their ongoing IT requirements, the sky is the limit. Sales support job description; One of the first questions that a small child will ask their parent is about the colour of the sky. The perpetual beauty of the blue sky wraps the entire Earth, or at

WeвЂ™ve created the new My Sky app with you in mind to make managing your Sky account and getting help and support quick and easy.View and вЂ¦ Why is the sky blue and not red? Update Cancel. Answer Wiki. 8 Answers. Vaughan Pratt, Physics major, taught CS @ MIT & Stanford, Why is the sky blue? Why is it

Diffuse sky radiation is solar radiation The explanation of the blue color by Rayleigh in 1871 is one of the most famous examples of the application of Light - Real-life applications there is an explanation not only for the question of why the sky is blue, but why sunsets are red, orange, and gold.

Since you see the blue light from everywhere overhead, the sky looks blue. As you look closer to the horizon, the sky appears much paler in color. To reach you, the scattered blue light must pass through more air. Some of it gets scattered away again in other directions. Less blue light reaches your eyes. Stupid Jokes Why The Sky Is Blue. We also have Stupid Jokes Why The Sky Is Blue quotes and sayings related to Stupid Jokes Why The Sky Is Blue.

Sky blue is the name of a colour that resembles the colour of the sky at noon. The entry for "sky-blue" in Murray's New English Dictionary (1919) reports a first Start studying why is the sky blue. Learn vocabulary, terms, and more with flashcards, games, and other study tools.

why is the sky blue. Uploaded 02/15/2008 why is the sky blue comment and tell NEXT JOKE Q Why did the blonde quit his job as a restroom attendant? 13 Comments. Diffuse sky radiation is solar radiation The explanation of the blue color by Rayleigh in 1871 is one of the most famous examples of the application of

why is the sky blue. Uploaded 02/15/2008 why is the sky blue comment and tell NEXT JOKE Q Why did the blonde quit his job as a restroom attendant? 13 Comments. Working with Blue sky. There are lots of jobs out there. There are only a few life-changing experiences and being part of the Blue sky team can give you the

## Rarest Eye Color in Humans Owlcation

Why is the Sky Blue? Mental Floss. After days of rain, a patch of blue sky is a sight for sore eyes. But why is the sky blue? So, when the Sun is high in the sky, blue light is scattered in all, Sky blue is the name of a colour that resembles the colour of the sky at noon. The entry for "sky-blue" in Murray's New English Dictionary (1919) reports a first.

### Why Is The Sky Blue? You Ask

New My Sky App Sky.com. 2013-09-09В В· As sunlight passes through the atmosphere, particles in the air scatter blue light more efficiently than any other color in the light spectrum, creating a, Explore the reasons why Sky Zone is the premier indoor trampoline park..

If you look in any popular science book on this topic, it will tell you that the sky is blue because of Rayleigh scattering in the atmosphere. Whil... Blue Sky Calvin Blue Necktie Men's Klein Check Application Status. We are in the process of transitioning to an improved job application system and in the interim we

EMPLOYMENT APPLICATION PERSONAL INFORMATION depending on the job position. Such a report, or a credit report (if applicable), will Why is the sky blue? Parents don't know what to say when their children ask. Why the Sky Is Blue answers this ancient and surprisingly complex question in a more

Working with Blue sky. There are lots of jobs out there. There are only a few life-changing experiences and being part of the Blue sky team can give you the Application for Individuals; Job Opportunities. Employee Benefits; Blue Sky Discover why the sky is blue and the sunset is red.

Some people think the sky is blue because of sunlight reflected off the Why is the sky blue and where does it start? Curious Kids: Why is the sky blue and Employment Careers and Jobs. Each day at Blue Mountain holds an exciting new challenge and an opportunity to bring out your best. Learn Why Blue. Whether you're

Why the Sky is blue (Scattering of Light) Relate the blue sky to the preferential scattering of light in its atmosphere. The daytime sky on Earth appears blue in colour. 16 Which Wich Cashier interview questions and 10 interview reviews. Application. I applied online. I I think one was "Why is the sky blue?"

The blueness of the sky is the result of a particular type of scattering called Rayleigh scattering, which refers to the selective scattering of light off of particles that are no вЂ¦ Why is the sky blue and not red? Update Cancel. Answer Wiki. 8 Answers. Vaughan Pratt, Physics major, taught CS @ MIT & Stanford, Why is the sky blue? Why is it

WHY THE SKY IS BLUE? you can never hope to be a man of science. You can perhaps get a job in some of the departments, get a nice comfortable salary, Sky blue is the name of a colour that resembles the colour of the sky at noon. The entry for "sky-blue" in Murray's New English Dictionary (1919) reports a first

If you look in any popular science book on this topic, it will tell you that the sky is blue because of Rayleigh scattering in the atmosphere. Whil... Working with Blue sky. There are lots of jobs out there. There are only a few life-changing experiences and being part of the Blue sky team can give you the

Sample Job Interview Questions for Accounting and Finance Jobs. Free guide plus tips and techniques. How to Answer any Job Interview Question Why is the sky blue is a question discussed including funny answers to scientific inquiry and silly explanations to different hypotheses.

EMPLOYMENT APPLICATION PERSONAL INFORMATION depending on the job position. Such a report, or a credit report (if applicable), will BlueSkySearch.com is the Online Job Center for the Produce Industry, Agriculture and the Food Industry - Produce Jobs, Produce Industry Jobs, Agriculture Jobs, Food

What I'm wondering is, given that the spectrum of Rayleigh scattering goes like $\omega^4$, why is the sky not purple, rather than blue? How to save my job? Why is the sky blue? You may think that it is because of the ocean (a lot of people do), but it is not. To answer this question, we should begin with the S

SCIENCE вЂ” Earth and Space. Have You Ever Wondered... Why is the sky blue? What color is sunlight? Why does the sky turn red and orange at dawn and dusk? WeвЂ™ve created the new My Sky app with you in mind to make managing your Sky account and getting help and support quick and easy.View and вЂ¦

How to Get Hired by Lockheed Martin. I have yet to hear from anyone regarding the position or my application. It might not be true of all вЂњblue skyвЂќ jobs, 2013-09-09В В· As sunlight passes through the atmosphere, particles in the air scatter blue light more efficiently than any other color in the light spectrum, creating a

Wikipedia:You do need to cite that the sky is blue A statement that "the sky is blue" may be questioned because the sky frequently has a different colour Blue Sky Calvin Blue Necktie Men's Klein Check Application Status. We are in the process of transitioning to an improved job application system and in the interim we

Sample Job Interview Questions for Accounting and Finance Jobs. Free guide plus tips and techniques. How to Answer any Job Interview Question Start studying why is the sky blue. Learn vocabulary, terms, and more with flashcards, games, and other study tools.

St. JohnвЂ™s Office. T: 709.733.CARE (2273) F: 709.757.3551 E: info@blueskyfamilycare.com . Suite 111, 38 Ropewalk Lane St. JohnвЂ™s, NL A1E 5T2 Working with Blue sky. There are lots of jobs out there. There are only a few life-changing experiences and being part of the Blue sky team can give you the

Light is made up of waves of different sizes called wavelengths. The short waves look blue. Our atmosphere is like a blanket made up of gases and particles that wraps Jobs. Business. Flights . Check Flight Revision to Airport Badge Application Form and Definition of Safety and security are the top priorities at Phoenix Sky

Current graduate and undergraduate students in engineering, science, technology, accounting, and business are invited to apply for this 12 to 15-week program. Most Blue Origin internships are available at our facility in Kent, Washington, but we also have opportunities at our facilities in West Texas and Cape Canaveral, Florida. Also, a list of information required for most job applications. The Balance Careers and blue collar jobs as a way to whittle down those candidates they want to

Blue Sky Calvin Blue Necktie Men's Klein Check Application Status. We are in the process of transitioning to an improved job application system and in the interim we Diffuse sky radiation is solar radiation The explanation of the blue color by Rayleigh in 1871 is one of the most famous examples of the application of

Application for Individuals; Job Opportunities. Employee Benefits; Blue Sky Discover why the sky is blue and the sunset is red. Like most curious people, you have probably asked at some time, вЂњWhy is the sky blue?вЂќ Or if you saw a beautiful sunset or sunrise, you might have asked, вЂњWhy

### Rarest Eye Color in Humans Owlcation

Tyndall effect- why the sky is blue- Learn Chemistry. Why can't you hear a pterodactyl urinate? Why is the sky blue? submitted 4 years ago by callousCnidarian. And how can we cheer it up? 1 comment;, Show yourself or others how to use the EpiPen (epinephrine) Auto-Injector in the event of a severe allergic reaction. Learn more at EpiPen.ca. Blue to the sky..

Meaning of The Color Blue Bourn Creative. Like most curious people, you have probably asked at some time, вЂњWhy is the sky blue?вЂќ Or if you saw a beautiful sunset or sunrise, you might have asked, вЂњWhy, Please send your application, and details why you are best suited for the job. LSG Sky Chefs Positions Available:.

### Join the people behind Sky Sky Careers

Join the people behind Sky Sky Careers. Why is the sky blue? You may think that it is because of the ocean (a lot of people do), but it is not. To answer this question, we should begin with the S https://en.wikipedia.org/wiki/Blue Working with Blue sky. There are lots of jobs out there. There are only a few life-changing experiences and being part of the Blue sky team can give you the.

Why can't you hear a pterodactyl urinate? Why is the sky blue? submitted 4 years ago by callousCnidarian. And how can we cheer it up? 1 comment; Light is made up of waves of different sizes called wavelengths. The short waves look blue. Our atmosphere is like a blanket made up of gases and particles that wraps

Employee Application Form. Blue Sky only works with ex-offenders and is required to collect information relating to applicants' offending Job title and duties Wikipedia:You do need to cite that the sky is blue A statement that "the sky is blue" may be questioned because the sky frequently has a different colour

The Meanings of Blue: Blue is the favorite color of all people. ItвЂ™s natureвЂ™s color for water and sky, but is rarely found in fruits and vegetables. IT support job description . supporting the rest of the business with their ongoing IT requirements, the sky is the limit. Sales support job description;

If a job application asked you "Why is the sky blue?" what would be your initial response, funny or otherwise? If a job application asked you "Why is the sky blue?" Sky blue is the name of a colour that resembles the colour of the sky at noon. The entry for "sky-blue" in Murray's New English Dictionary (1919) reports a first

16 Which Wich Cashier interview questions and 10 interview reviews. Application. I applied online. I I think one was "Why is the sky blue?" What I'm wondering is, given that the spectrum of Rayleigh scattering goes like $\omega^4$, why is the sky not purple, rather than blue? How to save my job?

Job application forms (also called вЂњemployment formsвЂќ) Instructions: Print clearly in black or blue ink. Answer all questions. Sign and date the form. Like most curious people, you have probably asked at some time, вЂњWhy is the sky blue?вЂќ Or if you saw a beautiful sunset or sunrise, you might have asked, вЂњWhy

WeвЂ™ve created the new My Sky app with you in mind to make managing your Sky account and getting help and support quick and easy.View and вЂ¦ When asked why the sky is blue, Owlcation В» STEM В» Physics; Why Is the Sky Blue? Hint: It's Probably Not for the Reason You Think. Updated on January 6,

Light is made up of waves of different sizes called wavelengths. The short waves look blue. Our atmosphere is like a blanket made up of gases and particles that wraps Blue Sky Resumes is a small team of professional writers and job search experts. We offer one-of-a-kind resumes, smart career advice and fantastic customer service.

WHY THE SKY IS BLUE? you can never hope to be a man of science. You can perhaps get a job in some of the departments, get a nice comfortable salary, Meaning of the color blue is open spaces, freedom, intuition, Blue represents both the sky and the sea, and is associated with open spaces, freedom,

Why is the sky blue? Why is a sunset red? How does light bounce off of a molecule? As Lord Rayleigh and Sir Raman discovered, the answer is scattering! Meaning of the color blue is open spaces, freedom, intuition, Blue represents both the sky and the sea, and is associated with open spaces, freedom,

Why is the sky blue? Why is a sunset red? How does light bounce off of a molecule? As Lord Rayleigh and Sir Raman discovered, the answer is scattering! Why can't you hear a pterodactyl urinate? Why is the sky blue? submitted 4 years ago by callousCnidarian. And how can we cheer it up? 1 comment;

View all posts in Alberta category


text:
# Count the number of occurrences of a word

I was selected for the third round of MS internships for third years. We were surprisingly asked a very easy question: “Make a program that counts the number of times the WORD "a" or "A" occurs”. I wrote the code below and was rejected from attending the final interview.

What is wrong with my code? Please tell me how to improve it. People who used Char[] instead of string and those who didn't check for first and last words to be "A" were all selected. The condition for commas before and after 'a' was also ignored. What is the error? Is str.at(i) not good enough...? I know even if we use str[i] it is interpreted as str.operator[](i), so I'm preventing the overhead conversion, right?

#include<iostream>
#include<ctype.h>
#include<string>

using namespace std;

int main()
{

string str;

getline(cin,str);

int i;
int count=0;
int l=str.length();

for(i=1;i<l-1;i++)
{
if(toupper(str.at(i))=='A')
if(str.at(i-1)==' ' && str.at(i+1)==' ')
count++;
}

if(toupper(str.at(0))=='A' && str.at(1)==' ')
count++;

if(toupper(str.at(l-1))=='A' && str.at(l-2)==' ')
count++;

cout<<"Count is "<<count<<endl;
return 0;

}

• What version of C++ are you using? I'm not familiar with the included statement. – Kevin Aug 15 '12 at 18:17
• One problem I see is: what happens if your input string is just 'A'? – rpsml Aug 15 '12 at 18:19
• "a" & 'a' are different, 'a' is a single character whereas "a" is a string i.e. 'a','\0' – another.anon.coward Aug 15 '12 at 18:20
• What I would have done is use a std::stringstream. I think that is the easiest possible way. – StackUnderflow Aug 15 '12 at 18:21
• I would have tried a state machine. It is probably quite simple to implement and have a single forwarding loop over the input. – David Rodríguez - dribeas Aug 15 '12 at 19:01

First of all, these interview questions are often a trick. It doesn't really matter if your code works for all cases (everybody makes mistakes). What does matter is how you write the code.

Even if they ask specifically for 'a' or 'A', you are not supposed to hardcode these values. They are a parameter. Understanding what is the input to your program is always the first task. If they ask you "Make a program that counts the number of times the letter 'a' occurs in 'Example'", the correct answer won't be return 1;. They also ask for words, you shouldn't assume that the program should search only for words withs 1 letter.

Second - words are not usually delimited only by a space. You should consider all whitespace and punctuation characters. Or just declare a function isWordDelimiter(char) and don't implement it.

Third - your code is not easily readable. An if inside another if in a for? Use functions. Example (pseudocode - I am not C++ programmer and I forgot STL):

while ((word = getNextWord(input)) != NULL) {
if (word is in set of searched words) {  //replace this with STL set
count++
}
}

Summary: Even on a very simple program, they can see how much experienced you are. Good developer won't just write something that works. He has to think how the problem will evolve in the future (different parameters), how the program will be maintained (write readable code). Good developers also write programs from top to bottom - first define the structure using high level functions, then write the implementation of the functions.

• I wouldn't call such questions a "trick" - instead, they are seemingly-simple questions that can be attempted by anybody, but can also be ramped up to exercise even outstanding candidates ("How do you identify word boundaries? In Japanese?"). Also, in an interview (unlike a written test), they give the candidate an opportunity to show how they gather requirements ("What size input are you giving me? Do I need to case-fold in a specific locale?"). – Toby Speight Jul 24 '18 at 9:50

You should do this by using the standard library to its fullest:

std::istringstream ss(str);
auto count = std::count_if(std::istream_iterator<std::string>(ss), std::istream_iterator<std::string>(),
[](const std::string& s){ return s == "a" || s == "A"; });

• @David Rodríguez - dribeas You're both wrong. It works. Try it or read it more carefully. ideone.com/qq3Bd – David Aug 15 '12 at 19:01
• Unfortunately this fails if there is punctuation in the input stream. – Martin York Aug 15 '12 at 19:56
• More accurately it fails to detect 'a' or 'A' as a word if an adjacent character is punctuation. But, this just replaces the OPs code - it doesn't add extra functionality. – David Aug 17 '12 at 1:50
included <iostream> <ctype.h> <string>

If this is the actual code you sent, I probably wouldn't have read past this line. It's not valid C++ or anything. It suggests you didn't even try to compile and run this.

using namespace std;

int main()
{

string str;

getline(cin,str);

int i;

Why are you declaring this here instead of the for loop

    int count=0;
int l=str.length();

for(i=1;i<l-1;i++)
{
if(toupper(str.at(i))=='A')
if(str.at(i-1)==' ' && str.at(i+1)==' ')
count++;

I wouldn't have nested braceless blocks like this. It can making things harder to read. }

    if(toupper(str.at(0))=='A' && str.at(1)==' ')
count++;

if(toupper(str.at(l-1))=='A' && str.at(l-2)==' ')
count++;

This is an ugly solution. It'd be better if you worked this into the loop.

    cout<<"Count is "<<count<<endl;
return 0;

}

• I would hope the interviewer knows what the first line means. If this was on a whiteboard, I'd do the same. – GManNickG Aug 15 '12 at 18:41
• @GManNickG: White board sure. In sample code sent for interview not so much. It must compile. – Martin York Aug 15 '12 at 20:21
• Guys..It was a written test...and I included it ..you mean I should put those limit checking constraints into the loop..why to execute it again and again if it doesn't depend on the index i...? You guys think i complicated things using str.at(i)...? After that round I discovered that a loop iterating from 1 to n-1 and using char[] without converting to toupper was selected for next round.....Is it advantageous to use char[]...??? – Sekharan Natarajan Aug 16 '12 at 12:31

don't vote.

Extended comment.

My first pass at this would be:

int main()
{
std::cout << "Count of word 'a' or 'A': "
<< std::count_if(std::istream_iterator<std::string>(std::cin),
std::istream_iterator<std::string>(),
[](std::string const& word)
{
return word == "a" || word == "A";
}
);
}

But the problem with this is that this only breaks up words based on space. What happens if there is punctuation in the input?

Well just imbue the stream with a facet that tells the stream functors that all non word characters are space and then the stream operators will work.

class OnlyLettersNotSpaceFacet: public std::ctype<char>
{
public:
typedef std::ctype<char>   base;
typedef base::char_type    char_type;

OnlyLettersNotSpaceFacet(std::locale const& l) : base(table)
{
// Get the ctype facet of the current locale
std::ctype<char> const&  defaultCType = std::use_facet<std::ctype<char> >(l);

// Copy the default flags for each character from the current facet
static char data[256];
for(int loop = 0; loop < 256; ++loop) {data[loop] = loop;}
defaultCType.is(data, data+256, table);

for(int loop = 0; loop < 256; ++loop)
{
if (!std::isalpha(loop))
{   table[loop] |= base::space;  // anything that is not alpha
}                                // is now considered a space.
}
}
private:
};

Now we can write the code just like we did first time (after imbuing the stream).

int main()
{
// Create a local and imbue the stream with it.
const std::locale olns(std::cin.getloc(), new OnlyLettersNotSpaceFacet(std::cin.getloc()));
std::cin.imbue(olns);

std::cout << "Count of word 'a' or 'A': "
<< std::count_if(std::istream_iterator<std::string>(std::cin),
std::istream_iterator<std::string>(),
[](std::string const& word)
{
return word == "a" || word == "A";
}
);
}
// Note some systems have a bug in the standard where imbue on std::cin
// silently fails. If this is the case then convert the code to read from a file.
// Note you need to imbue the filestream before opening it.

• In the previous round there was a question on merging two sorted arrays...If I had used STL then it takes 1 or two lines...but..i felt they are actually trying to test the concepts... – Sekharan Natarajan Aug 16 '12 at 12:36
• @SekharanNatarajan Then you should have asked if you could use STL. Personally I'm more impressed by proper library usage than ability to write a trivial low level algorithm (which, with c++11, is becoming an increasingly rare task in the real world) – David Aug 17 '12 at 12:50
• True...but writing algorithm is what I believe they wanted to test on..Using an inbuilt algo is such cases makes the prob too easy rite???? – Sekharan Natarajan Aug 25 '12 at 10:36
• @SekharanNatarajan: I doubt it. This problem is designed to see if you understand how the formatted input operators work. operator>> reads a word. Can you use it with algorithms (the built in ones) can you spot the inherent problem (punctuation). What are some simple solutions to those problems (strip punctuation manually or use a locale to strip automatically). – Martin York Aug 27 '12 at 6:14

... and those who didn't check for first and last words to be "A" were all selected

maybe they wrote a loop that didn't need to special case the first & last characters, and that was considered cleaner?

Is str.at(i) not good enough...?

std::basic_string::at does bounds checking. You either need this, in which case you've arguably written your loop condition poorly and should be prepared to handle a std::out_of_range exception, or you wrote the loop safely, don't need the bounds checking, and needn't pay for it.

Because you might fail the bounds checking here, but don't handle the exception, your program will just terminate for some valid input strings.

I know even if we use str[i] it is interpreted as str.operator, so I'm preventing the overhead conversion, right?

what conversion? this is syntactic sugar resolved at compile time. You're either calling

str.at[i] => std::basic_string<char>::at(int i)

or

str[i]    => std::basic_string<char>::operator[](int i)

the fact that one has a fancy-looking syntax doesn't affect the cost of calling it.

Actually, as I mentioned above, operator[] is cheaper because it doesn't do the bounds checking (which you don't handle correctly anyway).

Oh, and for completeness, a sample (untested) one-pass state machine that doesn't require special cases for the first and last characters:

class CountA
{
int count_;
enum { NewWord, PossibleMatch, NonMatch } state_;

void next(char c)
{
if (isalnum(c)) { // assuming words are alphanumeric strings only
switch (state_) {
case NewWord: // first char of a new word
state_ = (toupper(c) == 'A') ? PossibleMatch : NonMatch;
break;
case PossibleMatch:   // had "A", got "Ax"
state_ = NonMatch;
case NonMatch:      ; // just a non-match getting longer
}
} else {
if (state_ == PossibleMatch) ++count_; // complete match!
state_ = NewWord;
}
}
public:
CountA() : count_(0), state_(NewWord) {}
int count() const { return count_; }

void scan(std::string const &str)
{
char const *p = str.c_str();
do {
next(*p);
} while(*p++);
}
};


text:
# Is this an example of a group?

Let G be a set having more than one element and let $a\ast b=a$ for all $a,b$ in $G$. Is $G$ a group under this operation?

• I think $\ast$ is associative since $(a\ast b)\ast c=a$ and $a\ast (b\ast c)=a$.
• I also think there exists an $e$ in $G$ such that $a\ast e=a$ and $e\ast a=a$ for all $a$ in $G$, because you can just choose $e=a$ and this seems to work.
• What is the inverse of $a$? Can the inverse of $a$ just be $a$? Is this allowed? Does this work?
-
How can you set $e=a$ when $a$ can be anything and $e$ needs to be fixed? – N. S. Sep 26 '12 at 1:41
I didn't know e had to be fixed. I thought it just had to exist for all a. – user39794 Sep 26 '12 at 1:50
@AllisonCameron: The order of "there exists" and "for all" is very important. Compare the following two statements: 1. There exists an $e \in G$ such that $a * e = e * a = a$ for all $a \in G$. 2. For all $a \in G$, there exists an $e \in G$ such that $a * e = e * a = a$. Do you see the difference between them? – Théophile Sep 26 '12 at 3:37
This structure has a name it is called a left-zero semigroup. – user1729 Aug 5 '13 at 9:25

No, you don’t have an identity. There is no single element $e\in G$ such that $e*a=a*e=a$ for all $a\in G$. Suppose that we actually had such an $e$. By hypothesis there is at least one $a\in G$ such that $a\ne e$. But then $e*a=e\ne a$, and $e$ isn’t an identity element after all.

You’ve shown that for each $a\in G$ there is some $x\in G$ such that $x*a=a*x=a$, namely $x=a$, but this isn’t what it means to have an identity. For that you need a single element, $e$, that works for all $a\in G$. In logical notation, you’ve proved that

$$\forall a\in G\exists e\in G(a*e=e*a=a)\;,\tag{1}$$

but the statement that $e$ is a group identity is

$$\exists e\in G\forall a\in G(a*e=e*a=a)\;,\tag{2}$$

with the quantifiers in the opposite order. In $(1)$ the $a$ is specified first, and you get to pick a different $e$ for each $a$. In $(2)$ the $e$ must be specified first, and then it has to work for all choices of $a$.

And of course if you have no identity, it’s meaningless to ask for inverses.

-

$ab=a$, and $ba=b$. Which of these two is the identity?

(If there is only one element, then this is indeed a group, and then $a=b$ in the situation above and there's no conflict.)

-

No, since non-identity elements have no inverse. If $ab=e$ then $a=e$.

-
Nothing can have an inverse: there is no identity element. – Brian M. Scott Sep 26 '12 at 1:49
@BrianM.Scott Well, in that case nothing having an inverse is equivalent to no non-identity having an inverse. :) This is just the first obstruction I saw to $G$ being a group. – Alex Becker Sep 26 '12 at 1:54
True, true. I didn’t mean to imply that it was wrong; it just struck me as oddly peripheral to the main problem! – Brian M. Scott Sep 26 '12 at 2:00

If you set $e=a$, does there exist more than one distinct element in your group? If $a,b\in G$ and $a\ne b$, then $e\ast b = e = a \ne b$. So it is not the case that $e\ast b = b$, which means $e$ is not an identity element. (Informal proof by contradiction.)

-

No, such structure is not a group. In literature it is often called right quasigroup.

It has no identity element (hence it is not a right loop), but all of its elements are right identities: we deduce it from the definition $a\ast b=a$.

How nobody said this before? ;)

-


text:
# IB DP Maths Topic 10.7 Simple graphs; connected graphs; complete graphs; HL Paper 3

## Question

The graph G has the following cost adjacency table.

$\begin{array}{*{20}{c|ccccc}} {}&{\text{A}}&{\text{B}}&{\text{C}}&{\text{D}}&{\text{E}} \\ \hline {\text{A}}& {\text{ – }}&9&{\text{ – }}&8&4 \\ {\text{B}}& 9&{\text{ – }}&7&{\text{ – }}&2 \\ {\text{C}}& {\text{ – }}&7&{\text{ – }}&7&3 \\ {\text{D}}& 8&{\text{ – }}&7&{\text{ – }}&5 \\ {\text{E}}& 4&2&3&5&{\text{ – }} \end{array}$

Draw G in a planar form.

[2]
a.

Giving a reason, determine the maximum number of edges that could be added to G while keeping the graph both simple and planar.

[4]
b.

List all the distinct Hamiltonian cycles in G beginning and ending at A, noting that two cycles each of which is the reverse of the other are to be regarded as identical. Hence determine the Hamiltonian cycle of least weight.

[10]
c.

## Markscheme

A2

[2 marks]

a.

For a simple planar graph containing triangles, $$e \leqslant 3v – 6$$     M1

Here $$v = 5{\text{ , so }}e \leqslant 9$$ .     A1

There are already 8 edges so the maximum number of edges that could be added is 1.     R1

This can be done e.g. AC or BD     R1

[4 marks]

b.

The distinct Hamiltonian cycles are

ABCDEA     A2

ABCEDA     A2

ABECDA     A2

AEBCDA     A2

Note: Do not penalise extra cycles.

The weights are 32, 32, 29, 28 respectively.     A1

The Hamiltonian cycle of least weight is AEBCDA.     R1

[10 marks]

c.

## Examiners report

A fairly common error in (a) was to draw a non-planar version of G, for which no credit was given. In (b), most candidates realised that only one extra edge could be added but a convincing justification was often not provided. Most candidates were reasonably successful in (c) although in some cases not all possible Hamiltonian cycles were stated.

a.

A fairly common error in (a) was to draw a non-planar version of G, for which no credit was given. In (b), most candidates realised that only one extra edge could be added but a convincing justification was often not provided. Most candidates were reasonably successful in (c) although in some cases not all possible Hamiltonian cycles were stated.

b.

A fairly common error in (a) was to draw a non-planar version of G, for which no credit was given. In (b), most candidates realised that only one extra edge could be added but a convincing justification was often not provided. Most candidates were reasonably successful in (c) although in some cases not all possible Hamiltonian cycles were stated.

c.

## Question

Prove that a graph containing a triangle cannot be bipartite.

[3]
b.

Prove that the number of edges in a bipartite graph with n vertices is less than or equal to $$\frac{{{n^2}}}{4}$$.

[5]
c.

## Markscheme

At least two of the three vertices in the triangle must lie on one of the two disjoint sets     M1R1

These two are joined by an edge so the graph cannot be bipartite     R1

[3 marks]

b.

If there are x vertices in one of the two disjoint sets then there are (nx) vertices in the other disjoint set     M1

The greatest number of edges occurs when all vertices in one set are joined to all vertices in the other to give x(nx) edges     A1

Function f(x) = x(n – x) has a parabolic graph.     M1

This graph has a unique maximum at $$\left( {\frac{n}{2},\frac{{{n^2}}}{4}} \right)$$.     A1

so $$x(n – x) \leqslant \frac{{{n^2}}}{4}$$     R1

[5 marks]

c.

## Examiners report

Part (a) was usually done correctly but then clear argument for parts (b) and (c) were rare.

b.

Part (a) was usually done correctly but then clear argument for parts (b) and (c) were rare.

c.

## Question

(a)     A connected planar graph G has e edges and v vertices.

(i)     Prove that $$e \geqslant v – 1$$.

(ii)     Prove that e = v −1 if and only if G is a tree.

(b)     A tree has k vertices of degree 1, two of degree 2, one of degree 3 and one of degree 4. Determine k and hence draw a tree that satisfies these conditions.

(c)     The graph H has the adjacency table given below.

$\left( {\begin{array}{*{20}{c}} 0&1&1&0&0&0 \\ 1&0&0&1&1&0 \\ 1&0&0&0&1&1 \\ 0&1&0&0&0&0 \\ 0&1&1&0&0&0 \\ 0&0&1&0&0&0 \end{array}} \right)$

(i)     Explain why H cannot be a tree.

(ii)     Draw the graph of H .

(d)     Prove that a tree is a bipartite graph.

## Markscheme

(a)     (i)     Euler’s relation is

$$e = v – 2 + f \geqslant v – 1,{\text{ as }}f \geqslant 1$$     M1A1

(ii)     $$G{\text{ is a tree }} \Leftrightarrow {\text{ no cycles }} \Leftrightarrow {\text{ }}f = 1$$     R1R1

[4 marks]

(b)     the result from (a) (ii) gives

$$e = k + 2 + 1 + 1 – 1 = k + 3$$     M1A1

for a tree we also have

$$2e = {\text{sum of degrees}}$$     M1

$$2k + 6 = k + 4 + 3 + 4 = k + 11$$

hence $$k = 5$$     A1

A2

Note: Accept alternative correct solutions.

[6 marks]

(c)     (i)     $$v – 1 = 5 < 6 = e\,\,\,\,\,{\text{by (a) (ii)}}$$     M1A1

G cannot be a tree     AG

(ii)          A1

[3 marks]

(d)     take any vertex in the tree and colour it black     M1

colour all vertices adjacent to a white vertex black

continue this procedure until all vertices are coloured     M1

which must happen since the graph is connected     R1

as the tree contains no cycles, no vertex can be both black and white and the graph is proved to be bipartite     R1

[4 marks]

Total [17 marks]

## Examiners report

Many candidates seem only to have a weak understanding of the requirements for the proof of a mathematical statement.

## Question

The planar graph G and its complement $$G’$$ are both simple and connected.

Given that G has 6 vertices and 10 edges, show that $$G’$$ is a tree.

## Markscheme

the complete graph with 6 vertices has 15 edges so $$G’$$ has

6 vertices and 5 edges     M1A1

the number of faces in $$G’$$ , $$f = 2 + e – v = 1$$     M1A1

it is therefore a tree because $$f = 1$$     R1

Note: Accept it is a tree because $$v = e + 1$$

[5 marks]

## Examiners report

Part (a) was well answered by many candidates.

## Question

Show that a graph is bipartite if and only if it contains only cycles of even length.

## Markscheme

Suppose the graph is bipartite so that the vertices belong to one of two disjoint sets M, N.     M1

Then consider any vertex V in M. To generate a cycle returning to V, we must go to a vertex in N, then to a vertex in M, then to a vertex in N, then to a vertex in M, etc.     R1

To return to V, therefore, which belongs to M, an even number of steps will be required.     R1

Now suppose the graph contains only cycles of even length.     M1

Starting at any vertex V, define the set M as containing those vertices accessible from V in an even number of steps and the set N as containing those vertices accessible from V in an odd number of steps.     R1

Suppose that the vertex X belongs to both M and N. Then consider the closed walk from V to X one way and back to V the other way. This closed walk will be of odd length. This closed walk can be contracted to a cycle which will also be of odd length, giving a contradiction to the initial assumption.     R1

There can therefore be no vertices common to M and N which shows that the vertices can be divided into two disjoint sets and the graph is bipartite.     R1

Consider any edge joining P to vertex Q. Then either $${\text{P}} \in {\text{M}}$$ in which case $${\text{Q}} \in {\text{M}}$$ or vice versa. In either case an edge always joins a vertex in M to a vertex in N so the graph is bipartite.     R1

[8 marks]

## Examiners report

Many candidates made a reasonable attempt at showing that bipartite implies cycles of even length but few candidates even attempted the converse.

## Question

(a)     Show that, for a connected planar graph,

$v + f – e = 2.$

(b)     Assuming that $$v \geqslant 3$$, explain why, for a simple connected planar graph, $$3f \leqslant 2e$$ and hence deduce that $$e \leqslant 3v – 6$$.

(c)     The graph G and its complement $${G’}$$ are simple connected graphs, each having 12 vertices. Show that $${G}$$ and $${G’}$$ cannot both be planar.

## Markscheme

(a)     start with a graph consisting of just a single vertex     M1

for this graph, v = 1, f = 1 and e = 0, the relation is satisfied     A1

Note: Allow solutions that begin with 2 vertices and 1 edge.

to extend the graph you either join an existing vertex to another existing vertex which increases e by 1 and f by 1 so that v + fe remains equal to 2     M1A1

or add a new vertex and a corresponding edge which increases e by 1 and v by 1 so that v + fe remains equal to 2     M1A1

therefore, however we build up the graph, the relation remains valid     R1

[7 marks]

(b)     since every face is bounded by at least 3 edges, the result follows by counting up the edges around each face     R1

the factor 2 follows from the fact that every edge bounds (at most) 2 faces     R1

hence $$3f \leqslant 2e$$     AG

from the Euler relation, $$3f = 6 + 3e – 3v$$     M1

substitute in the inequality, $$6 + 3e – 3v \leqslant 2e$$     A1

hence $$e \leqslant 3v – 6$$     AG

[4 marks]

(c)     let G have e edges     M1

since G and $${G’}$$ have a total of $$\left( {\begin{array}{*{20}{c}} {12} \\ 2 \end{array}} \right) = 66$$ edges     A1

it follows that $${G’}$$ has 66 – e edges     A1

for planarity we require

$$e \leqslant 3 \times 12 – 6 = 30$$     M1A1

and $$66 – e \leqslant 30 \Rightarrow e \geqslant 36$$     A1

these two inequalities cannot both be met indicating that both graphs cannot be planar     R1

[7 marks]

Total [18 marks]

## Examiners report

Parts (a) and (b) were found difficult by many candidates with explanations often inadequate. In (c), candidates who realised that the union of a graph with its complement results in a complete graph were often successful.

## Question

The vertices of a graph L are A, B, C, D, E, F, G and H. The weights of the edges in L are given in the following table.

Draw the graph L.

## Markscheme

A2

Note: Award A1 if one line missing or one line misplaced. Weights are not required.

[2 marks]

## Examiners report

Most candidates were able to draw the graph as required in (a) and most made a meaningful start to applying Prim’s algorithm in (b). Candidates were not always clear about the order in which the edges were to be added.

## Question

The graph G has adjacency matrix M given below.

Draw the graph G .

[2]
a.

What information about G is contained in the diagonal elements of M$$^2$$ ?

[1]
b.

List the trails of length 4 starting at A and ending at C.

[3]
d.

## Markscheme

A2

Note: Award A1 if only one error, A0 for two or more.

[2 marks]

a.

the (k, k) element of M$$^2$$ is the number of vertices directly connected to vertex k     A1

Note: Accept comment about the number of walks of length 2, in which the initial and final vertices coincide.

[1 mark]

b.

the trails of length 4 are ABEDC, AFEDC, AFEBC     A1A1A1

Note: A1A1A1 for three correct with no additions; A1A1A0 for all correct, but with additions; A1A0A0 for two correct with or without additions.

[3 marks]

d.

## Examiners report

Parts (a) and (c) were generally correctly answered. In part (b), a minority of candidates failed to mention that the starting and end points had to coincide. A large number of candidates gave all walks (trails were asked for) – an unnecessary loss of marks.

a.

Parts (a) and (c) were generally correctly answered. In part (b), a minority of candidates failed to mention that the starting and end points had to coincide. A large number of candidates gave all walks (trails were asked for) – an unnecessary loss of marks.

b.

Parts (a) and (c) were generally correctly answered. In part (b), a minority of candidates failed to mention that the starting and end points had to coincide. A large number of candidates gave all walks (trails were asked for) – an unnecessary loss of marks.

d.

## Question

Draw the complement of the following graph as a planar graph.

[3]
a.

A simple graph G has v vertices and e edges. The complement $$G’$$ of G has $${e’}$$ edges.

(i)     Prove that $$e \leqslant \frac{1}{2}v(v – 1)$$ .

(ii)     Find an expression for $$e + e’$$ in terms of v .

(iii)     Given that $${G’}$$ is isomorphic to G , prove that v is of the form 4n or 4n + 1 for $$n \in {\mathbb{Z}^ + }$$ .

(iv)     Prove that there is a unique simple graph with 4 vertices which is isomorphic to its complement.

(v)     Prove that if $$v \geqslant 11$$ , then G and $${G’}$$ cannot both be planar.

[14]
b.

## Markscheme

as a first step, form the following graph

(M1)(A1)

make it planar

A1

[3 marks]

a.

(i)     an edge joins a pair of vertices     R1

there is a maximum of $$\left( {\begin{array}{*{20}{c}} v \\ 2 \end{array}} \right) = \frac{1}{2}v(v – 1)$$ possible unordered pairs of vertices, hence displayed result     A1AG

(ii)     an edge joins two vertices in $${G’}$$ if it does not join them in G and vice versa; all possible edges are accounted for by the union of the two graphs     R1

$$e + e’ = \frac{1}{2}v(v – 1)$$     A1

(iii)     the two graphs have the same number of edges     R1

$$\Rightarrow e = \frac{1}{4}v(v – 1)$$     A1

v and v – 1 are consecutive integers, so only one can be divisible by 4, hence displayed result     A1AG

(iv)     the required graphs have four vertices and three edges     A1

if one vertex is adjacent to the other three, that uses up the edges; the resulting graph, necessarily connected, has a disconnected complement, and vice versa     R1

if one vertex is adjacent to two others, that uses up two edges; the final vertex cannot be adjacent to the first; the result is the linear connected graph     A1

state it is isomorphic to its complement     A1     N2

Note: Alternative proofs are possible, but should include the final statement for full marks.

(v)     using $$e \leqslant 3v – 6$$ for planar graphs     M1

$$\frac{1}{2}v(v – 1) = e + e’ \leqslant 6v – 12$$     A1

$${v^2} – 13v + 24 \leqslant 0$$ is not possible for $$v \geqslant 11$$     R1

[14 marks]

b.

## Examiners report

Part (a) was well done. The various parts of Parts (b) were often attempted, but with a disappointing feeling that the candidates did not have a confident understanding of what they were writing.

a.

Part (a) was well done. The various parts of Parts (b) were often attempted, but with a disappointing feeling that the candidates did not have a confident understanding of what they were writing.

b.

## Question

Draw the complement of the following graph as a planar graph.

[3]
a.

A simple graph G has v vertices and e edges. The complement $$G’$$ of G has $${e’}$$ edges.

(i)     Prove that $$e \leqslant \frac{1}{2}v(v – 1)$$ .

(ii)     Find an expression for $$e + e’$$ in terms of v .

(iii)     Given that $${G’}$$ is isomorphic to G , prove that v is of the form 4n or 4n + 1 for $$n \in {\mathbb{Z}^ + }$$ .

(iv)     Prove that there is a unique simple graph with 4 vertices which is isomorphic to its complement.

(v)     Prove that if $$v \geqslant 11$$ , then G and $${G’}$$ cannot both be planar.

[14]
b.

## Markscheme

as a first step, form the following graph

(M1)(A1)

make it planar

A1

[3 marks]

a.

(i)     an edge joins a pair of vertices     R1

there is a maximum of $$\left( {\begin{array}{*{20}{c}} v \\ 2 \end{array}} \right) = \frac{1}{2}v(v – 1)$$ possible unordered pairs of vertices, hence displayed result     A1AG

(ii)     an edge joins two vertices in $${G’}$$ if it does not join them in G and vice versa; all possible edges are accounted for by the union of the two graphs     R1

$$e + e’ = \frac{1}{2}v(v – 1)$$     A1

(iii)     the two graphs have the same number of edges     R1

$$\Rightarrow e = \frac{1}{4}v(v – 1)$$     A1

v and v – 1 are consecutive integers, so only one can be divisible by 4, hence displayed result     A1AG

(iv)     the required graphs have four vertices and three edges     A1

if one vertex is adjacent to the other three, that uses up the edges; the resulting graph, necessarily connected, has a disconnected complement, and vice versa     R1

if one vertex is adjacent to two others, that uses up two edges; the final vertex cannot be adjacent to the first; the result is the linear connected graph     A1

state it is isomorphic to its complement     A1     N2

Note: Alternative proofs are possible, but should include the final statement for full marks.

(v)     using $$e \leqslant 3v – 6$$ for planar graphs     M1

$$\frac{1}{2}v(v – 1) = e + e’ \leqslant 6v – 12$$     A1

$${v^2} – 13v + 24 \leqslant 0$$ is not possible for $$v \geqslant 11$$     R1

[14 marks]

b.

## Examiners report

Part (a) was well done. The various parts of Parts (b) were often attempted, but with a disappointing feeling that the candidates did not have a confident understanding of what they were writing.

a.

Part (a) was well done. The various parts of Parts (b) were often attempted, but with a disappointing feeling that the candidates did not have a confident understanding of what they were writing.

b.

## Question

Use the pigeon-hole principle to prove that for any simple graph that has two or more vertices and in which every vertex is connected to at least one other vertex, there must be at least two vertices with the same degree.

[4]
a.

Seventeen people attend a meeting.

Each person shakes hands with at least one other person and no-one shakes hands with

the same person more than once. Use the result from part (a) to show that there must be at least two people who shake hands with the same number of people.

[4]
b.

Explain why each person cannot have shaken hands with exactly nine other people.

[2]
c.

## Markscheme

let there be $$v$$ vertices in the graph; because the graph is simple the degree of each vertex is $$\le v – 1$$     A1

the degree of each vertex is $$\ge 1$$     A1

there are therefore $$v – 1$$ possible values for the degree of each vertex     A1

given there are $$v$$ vertices by the pigeon-hole principle there must be at least two with the same degree     R1

[4 marks]

a.

consider a graph in which the people at the meeting are represented by the vertices and two vertices are connected if the two people shake hands     M1

the graph is simple as no-one shakes hands with the same person more than once (nor can someone shake hands with themselves)     A1

every vertex is connected to at least one other vertex as everyone shakes at least one hand     A1

the degree of each vertex is the number of handshakes so by the proof above there must be at least two who shake the same number of hands     R1

Note: Accept answers starting afresh rather than quoting part (a).

[4 marks]

b.

(the handshaking lemma tells us that) the sum of the degrees of the vertices must be an even number     A1

the degree of each vertex would be $$9$$ and $$9 \times 17$$ is an odd number (giving a contradiction)     A1

[2 marks]

Total [10 marks]

c.

## Examiners report

Generally there were too many “waffly” words and not enough precise statements leading to conclusions.

Misconceptions were: thinking that a few examples constituted a proof, thinking that the graph had to be connected, taking the edges as the pigeons not the degrees. The pigeon-hole principle was known but not always applied well.

a.

Generally there were too many “waffly” words and not enough precise statements leading to conclusions.

Similar problems as in (a).

b.

Generally there were too many “waffly” words and not enough precise statements leading to conclusions.

Many spurious reasons were given but good candidates went straight to the hand-shaking lemma.

c.

## Question

Use the pigeon-hole principle to prove that for any simple graph that has two or more vertices and in which every vertex is connected to at least one other vertex, there must be at least two vertices with the same degree.

[4]
a.

Seventeen people attend a meeting.

Each person shakes hands with at least one other person and no-one shakes hands with

the same person more than once. Use the result from part (a) to show that there must be at least two people who shake hands with the same number of people.

[4]
b.

Explain why each person cannot have shaken hands with exactly nine other people.

[2]
c.

## Markscheme

let there be $$v$$ vertices in the graph; because the graph is simple the degree of each vertex is $$\le v – 1$$     A1

the degree of each vertex is $$\ge 1$$     A1

there are therefore $$v – 1$$ possible values for the degree of each vertex     A1

given there are $$v$$ vertices by the pigeon-hole principle there must be at least two with the same degree     R1

[4 marks]

a.

consider a graph in which the people at the meeting are represented by the vertices and two vertices are connected if the two people shake hands     M1

the graph is simple as no-one shakes hands with the same person more than once (nor can someone shake hands with themselves)     A1

every vertex is connected to at least one other vertex as everyone shakes at least one hand     A1

the degree of each vertex is the number of handshakes so by the proof above there must be at least two who shake the same number of hands     R1

Note: Accept answers starting afresh rather than quoting part (a).

[4 marks]

b.

(the handshaking lemma tells us that) the sum of the degrees of the vertices must be an even number     A1

the degree of each vertex would be $$9$$ and $$9 \times 17$$ is an odd number (giving a contradiction)     A1

[2 marks]

Total [10 marks]

c.

## Examiners report

Generally there were too many “waffly” words and not enough precise statements leading to conclusions.

Misconceptions were: thinking that a few examples constituted a proof, thinking that the graph had to be connected, taking the edges as the pigeons not the degrees. The pigeon-hole principle was known but not always applied well.

a.

Generally there were too many “waffly” words and not enough precise statements leading to conclusions.

Similar problems as in (a).

b.

Generally there were too many “waffly” words and not enough precise statements leading to conclusions.

Many spurious reasons were given but good candidates went straight to the hand-shaking lemma.

c.

## Question

The weights of the edges of a graph $$H$$ are given in the following table.

(i)     Draw the weighted graph $$H$$.

(ii)     Use Kruskal’s algorithm to find the minimum spanning tree of $$H$$. Your solution should indicate the order in which the edges are added.

(iii)     State the weight of the minimum spanning tree.

[8]
a.

Consider the following weighted graph.

(i) Write down a solution to the Chinese postman problem for this graph.

(ii) Calculate the total weight of the solution.

[3]
b.

(i)     State the travelling salesman problem.

(ii)     Explain why there is no solution to the travelling salesman problem for this graph.

[3]
c.

## Markscheme

(i)          A2

Note:     Award A1 if one edge is missing. Award A1 if the edge weights are not labelled.

(ii)     the edges are added in the order:

$$FG{\rm{ }}1$$     M1A1

$$CE{\rm{ }}2$$     A1

$$ED{\rm{ }}3$$

$$EG{\rm{ }}4$$     A1

$$AC{\rm{ }}4$$

Note:     $$EG$$ and $$AC$$ can be added in either order.

(Reject $$EF$$)

(Reject $$CD$$)

$$EB5$$ OR $$AB5$$     A1

Notes:     The minimum spanning tree does not have to be seen.

If only a tree is seen, the order by which edges are added must be clearly indicated.

(iii)     $$19$$     A1

[8 marks]

a.

(i)     eg$$PQRSRTSTQP$$ OR $$PQTSTRSRQP$$     M1A1

Note:     Award M1 if in either (i) or (ii), it is recognised that edge $$PQ$$ is needed twice.

(ii)     total weight $$= 34$$     A1

[3 marks]

b.

(i)     to determine a cycle where each vertex is visited once only (Hamiltonian cycle)     A1

of least total weight     A1

(ii)     EITHER

to reach $$P$$, $$Q$$ must be visited twice which contradicts the definition of the $$TSP$$     R1

OR

the graph is not a complete graph and hence there is no solution to the $$TSP$$     R1

[3 marks]

Total [14 marks]

c.

## Examiners report

Part (a) was generally very well answered. Most candidates were able to correctly sketch the graph of $$H$$ and apply Kruskal’s algorithm to determine the minimum spanning tree of $$H$$. A few candidates used Prim’s algorithm (which is no longer part of the syllabus).

a.

Most candidates understood the Chinese Postman Problem in part (b) and knew to add the weight of $$PQ$$ to the total weight of $$H$$. Some candidates, however, did not specify a solution to the Chinese Postman Problem while other candidates missed the fact that a return to the initial vertex is required.

b.

In part (c), many candidates had trouble succinctly stating the Travelling Salesman Problem. Many candidates used an ‘edge’ argument rather than simply stating that the Travelling Salesman Problem could not be solved because to reach vertex $$P$$, vertex $$Q$$ had to be visited twice.

c.

## Question

The graph $${K_{2,{\text{ }}2}}$$ is the complete bipartite graph whose vertex set is the disjoint union of two subsets each of order two.

Draw $${K_{2,{\text{ }}2}}$$ as a planar graph.

[2]
a.

Draw a spanning tree for $${K_{2,{\text{ }}2}}$$.

[1]
b.

Draw the graph of the complement of $${K_{2,{\text{ }}2}}$$.

[1]
c.

Show that the complement of any complete bipartite graph does not possess a spanning tree.

[3]
d.

## Markscheme

A1A1

Note:     Award A1 for a correct version of $${K_{2,{\text{ }}2}}$$ and A1 for a correct planar representation.

[2 marks]

a.

A1

[1 mark]

b.

A1

[1 mark]

c.

the complete bipartite graph $${K_{m,{\text{ }}n}}$$ has two subsets of vertices $$A$$ and $$B$$, such that each element of $$A$$ is connected to every element of $$B$$     A1

in the complement, no element of $$A$$ is connected to any element of $$B$$. The complement is not a connected graph     A1

by definition a tree is connected     R1

hence the complement of any complete bipartite graph does not possess a spanning tree     AG

[3 marks]

Total [7 marks]

d.

## Examiners report

Part (a) was generally well done with a large number of candidates drawing a correct planar representation for $${K_{2,2}}$$. Some candidates, however, produced a correct non-planar representation of $${K_{2,2}}$$.

a.

Parts (b) and (c) were generally well done with many candidates drawing a correct spanning tree for $${K_{2,2}}$$ and the correct complement of $${K_{2,2}}$$.

b.

Parts (b) and (c) were generally well done with many candidates drawing a correct spanning tree for $${K_{2,2}}$$ and the correct complement of $${K_{2,2}}$$.

c.

Part (d) tested a candidate’s ability to produce a reasoned argument that clearly explained why the complement of $${K_{m,n}}$$ does not possess a spanning tree. This was a question part in which only the best candidates provided the necessary rigour in explanation.

d.

## Question

The graph $${K_{2,{\text{ }}2}}$$ is the complete bipartite graph whose vertex set is the disjoint union of two subsets each of order two.

Draw $${K_{2,{\text{ }}2}}$$ as a planar graph.

[2]
a.

Draw a spanning tree for $${K_{2,{\text{ }}2}}$$.

[1]
b.

Draw the graph of the complement of $${K_{2,{\text{ }}2}}$$.

[1]
c.

Show that the complement of any complete bipartite graph does not possess a spanning tree.

[3]
d.

## Markscheme

A1A1

Note:     Award A1 for a correct version of $${K_{2,{\text{ }}2}}$$ and A1 for a correct planar representation.

[2 marks]

a.

A1

[1 mark]

b.     A1

[1 mark]

c.

the complete bipartite graph $${K_{m,{\text{ }}n}}$$ has two subsets of vertices $$A$$ and $$B$$, such that each element of $$A$$ is connected to every element of $$B$$     A1

in the complement, no element of $$A$$ is connected to any element of $$B$$. The complement is not a connected graph     A1

by definition a tree is connected     R1

hence the complement of any complete bipartite graph does not possess a spanning tree     AG

[3 marks]

Total [7 marks]

d.

## Examiners report

Part (a) was generally well done with a large number of candidates drawing a correct planar representation for $${K_{2,2}}$$. Some candidates, however, produced a correct non-planar representation of $${K_{2,2}}$$.

a.

Parts (b) and (c) were generally well done with many candidates drawing a correct spanning tree for $${K_{2,2}}$$ and the correct complement of $${K_{2,2}}$$.

b.

Parts (b) and (c) were generally well done with many candidates drawing a correct spanning tree for $${K_{2,2}}$$ and the correct complement of $${K_{2,2}}$$.

c.

Part (d) tested a candidate’s ability to produce a reasoned argument that clearly explained why the complement of $${K_{m,n}}$$ does not possess a spanning tree. This was a question part in which only the best candidates provided the necessary rigour in explanation.

d.

## Question

The graph $${K_{2,{\text{ }}2}}$$ is the complete bipartite graph whose vertex set is the disjoint union of two subsets each of order two.

Draw $${K_{2,{\text{ }}2}}$$ as a planar graph.

[2]
a.

Draw a spanning tree for $${K_{2,{\text{ }}2}}$$.

[1]
b.

Draw the graph of the complement of $${K_{2,{\text{ }}2}}$$.

[1]
c.

Show that the complement of any complete bipartite graph does not possess a spanning tree.

[3]
d.

## Markscheme

A1A1

Note:     Award A1 for a correct version of $${K_{2,{\text{ }}2}}$$ and A1 for a correct planar representation.

[2 marks]

a.

A1

[1 mark]

b.

A1

[1 mark]

c.

the complete bipartite graph $${K_{m,{\text{ }}n}}$$ has two subsets of vertices $$A$$ and $$B$$, such that each element of $$A$$ is connected to every element of $$B$$     A1

in the complement, no element of $$A$$ is connected to any element of $$B$$. The complement is not a connected graph     A1

by definition a tree is connected     R1

hence the complement of any complete bipartite graph does not possess a spanning tree     AG

[3 marks]

Total [7 marks]

d.

## Examiners report

Part (a) was generally well done with a large number of candidates drawing a correct planar representation for $${K_{2,2}}$$. Some candidates, however, produced a correct non-planar representation of $${K_{2,2}}$$.

a.

Parts (b) and (c) were generally well done with many candidates drawing a correct spanning tree for $${K_{2,2}}$$ and the correct complement of $${K_{2,2}}$$.

b.

Parts (b) and (c) were generally well done with many candidates drawing a correct spanning tree for $${K_{2,2}}$$ and the correct complement of $${K_{2,2}}$$.

c.

Part (d) tested a candidate’s ability to produce a reasoned argument that clearly explained why the complement of $${K_{m,n}}$$ does not possess a spanning tree. This was a question part in which only the best candidates provided the necessary rigour in explanation.

d.

## Question

A simple connected planar graph, has $$e$$ edges, $$v$$ vertices and $$f$$ faces.

(i)     Show that $$2e \ge 3f{\text{ if }}v > 2$$.

(ii)     Hence show that $${K_5}$$, the complete graph on five vertices, is not planar.

[6]
a.

(i)     State the handshaking lemma.

(ii)     Determine the value of $$f$$, if each vertex has degree $$2$$.

[4]
b.

Draw an example of a simple connected planar graph on $$6$$ vertices each of degree $$3$$.

[2]
c.

## Markscheme

(i)     METHOD 1

attempting to use $$f = e – v + 2$$ and $$e \le 3v – 6$$ (if $$v > 2$$)     (M1)

$$2e \le 6v – 12 = 6(e – f + 2) – 12$$     M1A1

leading to $$2e \ge 3f$$     AG

METHOD 2

each face is bounded by at least three edges     A1

Note:     Award A1 for stating $$e \ge 3f$$.

each edge either separates two faces or, if an edge is interior to a face, it gets counted twice     R1

Note:     Award R1 for stating that each edge contributes two to the sum of the degrees of the faces (or equivalent) ie, $$\sum {\deg (F) = 2e}$$.

adding up the edges around each face     R1

leading to $$2e \ge 3f$$     AG

(ii)     $${K_5}$$ has $$e = 10$$     A1

if the graph is planar, $$f = 7$$     A1

this contradicts the inequality obtained above     R1

hence the graph is non-planar     AG

[6 marks]

a.

(i)     the sum of the vertex degrees $$= 2e$$ (or is even) or equivalent     A1

(ii)     if each vertex has degree $$2$$, then $$2v = 2e$$     A1

substituting $$v = e$$ into Euler’s formula     M1

$$f = 2$$     A1

[4 marks]

b.

for example,

A2

[2 marks]

Total [12 marks]

c.

## Examiners report

In part (a) (i), many candidates tried to prove $$2e \ge 3f$$ with numerical examples. Only a few candidates were able to prove this inequality correctly. In part (a) (ii), most candidates knew that $${K_5}$$ has 10 edges. However, a number of candidates simply drew a diagram with any number of faces and used this particular representation as a basis for their ‘proof’. Many candidates did not recognise the ‘hence’ requirement in part (a) (ii).

a.

In part (b) (i), many candidates stated the ‘handshaking lemma’ incorrectly by relating it to the ‘handshake problem’. In part (b) (ii), only a few candidates determined that $$v = e$$ and hence found that $$f = 2$$.

b.

In part (c), a reasonable number of candidates were able to draw a simple connected planar graph on $$6$$ vertices each of degree $$3$$. The most common error here was to produce a graph that contained a multiple edge(s).

c.

## Question

The following diagram shows the graph $$G$$.

Show that $$G$$ is bipartite.

[2]
a.

State which two vertices should be joined to make $$G$$ equivalent to $${K_{3,{\text{ }}3}}$$.

[1]
b.

In a planar graph the degree of a face is defined as the number of edges adjacent to that face.

(i)     Write down the degree of each of the four faces of $$G$$.

(ii)     Explain why the sum of the degrees of all the faces is twice the number of edges.

[2]
c.

$$H$$ is a simple connected planar bipartite graph with $$e$$ edges, $$f$$ faces, $$v$$ vertices and $$v \ge 3$$.

Explain why there can be no face in $$H$$ of degree

(i)     one;

(ii)     two;

(iii)     three.

[3]
d.

Hence prove that for $$H$$

(i)     $$e \ge 2f$$;

(ii)     $$e \le 2v – 4$$.

[3]
e.

Hence prove that $${K_{3,{\text{ }}3}}$$ is not planar.

[2]
f.

## Markscheme

shading alternate vertices or attempting to list pairs     M1

EITHER

A1

OR

$$ADE$$ and $$BCF$$     A1

as no two equal shadings are adjacent, the graph is bipartite     AG

[2 marks]

a.

$$C$$ and $$E$$     A1

[1 mark]

b.

(i)     degree of each of the four faces is $$4$$     A1

(ii)     each edge bounds two faces     R1

[2 marks]

c.

(i)     simple so no loops     R1

(ii)     simple so no multiple edges (and $$v > 2$$)     R1

(iii)     bipartite graph so no triangles     R1

[3 marks]

d.

(i)     $$2e = \sum {\deg (f) \ge 4f}$$     R1

$$e \ge 2f$$     AG

(ii)     if $$H$$ is a simple connected planar graph then $$e + 2 = v + f$$     M1

$$e + 2 – v \le \frac{1}{2}e$$     M1

$$2e + 4 – 2v \le e$$

$$e \le 2v – 4$$     AG

[3 marks]

e.

for $${K_{3,{\text{ }}3}}{\text{ }}v = 6$$, and $$e = 9$$     A1

$$9 \le 2 \times 6 – 4$$ is not true, therefore $${K_{3,{\text{ }}3}}$$ cannot be planar     R1AG

[2 marks]

Total [13 marks]

f.

[N/A]

a.

[N/A]

b.

[N/A]

c.

[N/A]

d.

[N/A]

e.

[N/A]

f.


text:
## Python tutorial

In this tutorial, we demonstrate how the FastLZeroSpikeInference package can be used to deconvolve calcium imaging data from a single neuron. All demos require the FastLZeroSpikeInference package; installation instructions are provided here.

from FastLZeroSpikeInference import fast
import numpy as np
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

To illustratre the software, we use the following toy dataset.

gam = 0.98
y = np.power(gam, np.concatenate([np.arange(100), np.arange(100)]))
plt.plot(y)

The estimate_spikes function estimates spikes based on the calcium trace, exponential decay parameter $\gamma$, and a tuning parameter $\lambda$. This function solves

if the constraint parameter is set to false (default), and

if the constraint parameter is set to true. Here’s an example of the function applied to the toy data.

fit = fast.estimate_spikes(y, gam, 1, False)

By default, and to save computation time, the calcium concentration is not automatically estimated. However, the estimate_calcium function can be used to estimate the calcium concentration based on a prior fit.

# Determine calcium concentration from fit
fit = fast.estimate_calcium(fit)
plt.plot(fit['estimated_calcium'])

With estimated spike(s)

fit['spikes'][0]
101

Alternatively, both spikes and calcium concentrations can be computed with the estimate_spikes function with estimate_calcium parameter set to true.

fit = fast.estimate_spikes(y, gam, 1, False, True)

To solve the constrained problem

we set the constraint parameter to true in the estimate_spikes function. Consider the following example.

fit = fast.estimate_spikes(y, gam, 1, True, True)