marți, 11 decembrie 2018

c++ programming part 14



1211. The pseudocode implementation of the above mechanism (the pseudocode is
1212. a language close to natural language)
1213. print function
1214. for i = 1, n write st [i]
1215. - for each value I from 1 to n, the number of elements in the stack is
1216. write the value in the stack
work until you reach your goal
1217. function init;
1218. st [k] = 0
1219. In the succeeding function we enter the variable "as", which can be 0- does not
exist
1220. successor, or 1- there is successor successor function
1221. if st [k] 1222. as = 1
1223. else
1224. as = 0
1225. In the valid function we enter the variable "ev", which can be 0 - the element is
not
1226. valid, or 1- element is valid
1227. function valid
1228. ev = 1 (assuming the item is valid)

1229. Each position in the stack is tested and if two identical values ??are found, the
item is not valid.
1230. For i = 1,k-1
1231. if sti [i] = st [k]
1232. ev = 0
do not get discouraged
1233. Solution function if stack was completed to level n, ie the last one
1234. level.
1235. function solution
1236. solution = (k = n)
when you have failed 3 times to do something, then just try 4 times

Niciun comentariu:

Trimiteți un comentariu

Rețineți: Numai membrii acestui blog pot posta comentarii.