fix: converted single to triple backticks2 (#36229)
This commit is contained in:
@@ -6,12 +6,13 @@ localeTitle: اتساع البحث الأول
|
||||
|
||||
دعونا أولا تحديد فئة `Tree` لاستخدامها لتنفيذ خوارزمية Breadth First Search.
|
||||
|
||||
`class Tree:
|
||||
def __init__(self, x):
|
||||
self.val = x
|
||||
self.left = None
|
||||
self.right = None
|
||||
`
|
||||
```python
|
||||
class Tree:
|
||||
def __init__(self, x):
|
||||
self.val = x
|
||||
self.left = None
|
||||
self.right = None
|
||||
```
|
||||
|
||||
تنتقل خوارزمية البحث الأولى والاتساع من مستوى إلى آخر بدءًا من جذر الشجرة. سنستخدم `queue` لهذا الغرض.
|
||||
|
||||
|
||||
@@ -24,55 +24,57 @@ localeTitle: إنشاء فئة مكدس
|
||||
|
||||
#### الأساسية:
|
||||
|
||||
`function Stack() {
|
||||
var collection = [];
|
||||
this.print = function() {
|
||||
console.log(collection);
|
||||
};
|
||||
this.push = function(val){
|
||||
return collection.push(val);
|
||||
}
|
||||
this.pop = function(){
|
||||
return collection.pop();
|
||||
}
|
||||
this.peek = function(){
|
||||
return collection[collection.length-1];
|
||||
}
|
||||
this.isEmpty = function(){
|
||||
return collection.length === 0;
|
||||
}
|
||||
this.clear = function(){
|
||||
collection.length = 0;
|
||||
}
|
||||
}
|
||||
`
|
||||
```js
|
||||
function Stack() {
|
||||
var collection = [];
|
||||
this.print = function() {
|
||||
console.log(collection);
|
||||
};
|
||||
this.push = function(val){
|
||||
return collection.push(val);
|
||||
}
|
||||
this.pop = function(){
|
||||
return collection.pop();
|
||||
}
|
||||
this.peek = function(){
|
||||
return collection[collection.length-1];
|
||||
}
|
||||
this.isEmpty = function(){
|
||||
return collection.length === 0;
|
||||
}
|
||||
this.clear = function(){
|
||||
collection.length = 0;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### متقدم - بنية ES6 Class:
|
||||
|
||||
`class Stack {
|
||||
constructor() {
|
||||
this.collection = [];
|
||||
}
|
||||
print(){
|
||||
console.log(this.collection);
|
||||
}
|
||||
push(val){
|
||||
retiurn this.collection.push(val);
|
||||
}
|
||||
pop(){
|
||||
return this.collection.pop();
|
||||
}
|
||||
peek(){
|
||||
return this.collection[this.collection.length-1];
|
||||
}
|
||||
isEmpty(){
|
||||
return this.collection.length === 0;
|
||||
}
|
||||
clear(){
|
||||
return this.collection.length = 0;
|
||||
}
|
||||
}
|
||||
`
|
||||
```js
|
||||
class Stack {
|
||||
constructor() {
|
||||
this.collection = [];
|
||||
}
|
||||
print(){
|
||||
console.log(this.collection);
|
||||
}
|
||||
push(val){
|
||||
retiurn this.collection.push(val);
|
||||
}
|
||||
pop(){
|
||||
return this.collection.pop();
|
||||
}
|
||||
peek(){
|
||||
return this.collection[this.collection.length-1];
|
||||
}
|
||||
isEmpty(){
|
||||
return this.collection.length === 0;
|
||||
}
|
||||
clear(){
|
||||
return this.collection.length = 0;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
\### مصادر:
|
||||
|
||||
|
||||
@@ -19,32 +19,37 @@ localeTitle: ابحث عن الحد الأدنى والحد الأقصى لار
|
||||
|
||||
### لوحة المفاتيح
|
||||
|
||||
`Ctrl + Shift + I
|
||||
`
|
||||
```
|
||||
Ctrl + Shift + I
|
||||
```
|
||||
|
||||
### شريط القوائم
|
||||
|
||||
#### ثعلب النار
|
||||
|
||||
`Tools ➤ Web Developer ➤ Toggle Tools
|
||||
`
|
||||
```
|
||||
Tools ➤ Web Developer ➤ Toggle Tools
|
||||
```
|
||||
|
||||
#### كروم / الكروم
|
||||
|
||||
`Tools ➤ Developer Tools
|
||||
`
|
||||
```
|
||||
Tools ➤ Developer Tools
|
||||
```
|
||||
|
||||
#### رحلات السفاري
|
||||
|
||||
`Develop ➤ Show Web Inspector.
|
||||
`
|
||||
```
|
||||
Develop ➤ Show Web Inspector.
|
||||
```
|
||||
|
||||
إذا لم تتمكن من رؤية قائمة التطوير ، فانتقل إلى `Safari ➤ Preferences ➤ Advanced` وتحقق من مربع الاختيار `Show Develop menu` في شريط القائمة.
|
||||
|
||||
#### دار الأوبرا
|
||||
|
||||
`Developer ➤ Web Inspector
|
||||
`
|
||||
```
|
||||
Developer ➤ Web Inspector
|
||||
```
|
||||
|
||||
### قائمة السياق
|
||||
|
||||
|
||||
@@ -14,11 +14,12 @@ localeTitle: تعرف على كيفية عمل Stack
|
||||
|
||||
### حل:
|
||||
|
||||
`var homeworkStack = ["BIO12","HIS80","MAT122","PSY44"];
|
||||
|
||||
homeworkStack.pop();
|
||||
homeworkStack.push("CS50");
|
||||
`
|
||||
```js
|
||||
var homeworkStack = ["BIO12","HIS80","MAT122","PSY44"];
|
||||
|
||||
homeworkStack.pop();
|
||||
homeworkStack.push("CS50");
|
||||
```
|
||||
|
||||
### مرجع:
|
||||
|
||||
|
||||
@@ -11,12 +11,13 @@ localeTitle: مصفوفات مكتوبة
|
||||
|
||||
### حل:
|
||||
|
||||
`//Create a buffer of 64 bytes
|
||||
var buffer = new ArrayBuffer(64);
|
||||
|
||||
//Make 32-bit int typed array with the above buffer
|
||||
var i32View = new Int32Array(buffer);
|
||||
`
|
||||
```js
|
||||
//Create a buffer of 64 bytes
|
||||
var buffer = new ArrayBuffer(64);
|
||||
|
||||
//Make 32-bit int typed array with the above buffer
|
||||
var i32View = new Int32Array(buffer);
|
||||
```
|
||||
|
||||
### المراجع:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user